Revert the use of filter-branch in Git
-
02-06-2021 - |
Domanda
I used git filter-branch and screwed something up and accidentally rewrote sections of the history I didn't want to. I was trying to change one name and accidentally changed every single commit (instead of only ones with a specific name).
I know that 'git filter-branch' keeps a backup at refs/original, but I don't know how to revert the master branch to this old version. What's the git command to do this?
Soluzione
If you know the commit id you're trying to revert to, you can use
$ git checkout master
$ git reset --hard <commit id>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow