Say you are in a branch topic
, you have been working for a while and want to merge in some commits from master
.
You run git merge
and there are a few conflicts. But you don't have time to resolve the merge conflicts now, and you want to return to the state that you were in before running git merge
.
There are three ways of which I know to do this:
git merge --abort
git reset --merge
git reset --hard HEAD
?Is any one of the three acceptable? What is the difference between them in this case?
git merge --abort
is preferable to git reset --hard HEAD
, because (from git merge
man page) it will remove .git/MERGE*
files (like MERGE_HEAD
).
git reset --hard
will not, which means git will believe a merge is still in progress.
And git reset --merge
is simply what was used before git merge --abort
was introduced (in git 1.7.4, as I mentioned here).