Within my master branch, I did a git merge some-other-branch
locally, but never pushed the changes to origin master. I didn\'t mean to merge, so I\'d like to un
With modern Git, you can:
git merge --abort
Older syntax:
git reset --merge
Old-school:
git reset --hard
But actually, it is worth noticing that git merge --abort
is only equivalent to git reset --merge
given that MERGE_HEAD
is present. This can be read in the Git help for merge command.
git merge --abort is equivalent to git reset --merge when MERGE_HEAD is present.
After a failed merge, when there is no MERGE_HEAD
, the failed merge can be undone with git reset --merge
, but not necessarily with git merge --abort
, so they are not only old and new syntax for the same thing.
Personally I find git reset --merge
much more powerful and useful in everyday work, so that's the one I always use.