In git let say I commit A and B
A---[B]
But then I revert with
git revert HEAD
So I am there now:
If you haven't done it completely, i.e., in gitbash
you see something like:
Username@Host MINGW64 /d/code/your-project (feature|REVERTING)
then you can use git revert --abort
to abort.
If you have done it.. just don't reset, the changes are still there. Use git reset
to change the state. Instead of --hard
, you can also use --soft
(keep all the changes).
git reset --soft HEAD^ // discard the last commit, keeping all the changes after that
Also, if you want to revert more than 1 commits:
git reset --soft HEAD~3 // discart last 3 commits. Don't know if it works for commits of others.