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
It is strange that the simplest command was missing. Most answers work, but undoing the merge you just did, this is the easy and safe way:
git reset --merge ORIG_HEAD
The ref ORIG_HEAD
will point to the original commit from before the merge.
(The --merge
option has nothing to do with the merge. It's just like git reset --hard ORIG_HEAD
, but safer since it doesn't touch uncommitted changes.)