It is best to initiate a revert with a clean index and working tree.
Otherwise, doing a second revert (on top of a new commit) while a previous revert was in progress leads to that error message.
Since you are still at commit 3
, you could:
git cherry-pick --quit
(which, from this thread, tells revert to leaveHEAD
alone and get out of the way.),- examine your index and working tree (git status),
- make any adjustment to get a clean status (like a new commit),
- and then re-do your
git revert
.
(you can see other options at "Rollback to Previous Commit - Github for MAC (a revert is already in progress)")
Don't forget git reset
if you simply want to forget about those three commits (although that would make you force a push: git push --force
, in order to publish your history for that branch. If other collaborators already pulled from that same branch, your approach, using git revert
, is a better one)