Reputation: 10350
When we run 'git revert HEAD~9', here is the error:
$ git revert HEAD~9
error: could not revert 45ebde6... AC: added stat summary function
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
The problem is that after we solve the conflicts and commit, then git revert HEAD~9
brings up the exact same conflict again. We get into this strange loop and never going anywhere with git revert' and
commit` (just increase of junk commit!). How to fix this problem?
Upvotes: 0
Views: 360
Reputation: 992737
Based on your comments above, what you would like to do is throw away the most recent 9 commits. In this case, git revert
is not the command you need to use. Instead, git reset
is correct:
git reset --hard HEAD~9
This will reset your current branch pointer to 9 commits back from HEAD
. The --hard
option also changes the files in your working copy to match the state they were at HEAD~9
.
Upvotes: 2