Remove a file from Git history without deleting the file
I used GitHub’s instructions for scrubbing a file from the commit history, but it deleted the file in question from my system. This was surprising to me because the
I’m using Git 2.6.1.
How can I delete a file from the commit history without deleting the file itself? Obviously I could just make a backup (which I did in my case), but that’s a workaround and not a solution.
If you forgot to back it up, you can still get it back! Git takes a long time to throw things out, your original commits are still in there. After
In general, you can recover filters and rebases using
I can use