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
Lately, I've been using git reflog
to help with this. This mostly only works if the merge JUST happened, and it was on your machine.
git reflog
might return something like:
fbb0c0f HEAD@{0}: commit (merge): Merge branch 'master' into my-branch
43b6032 HEAD@{1}: checkout: moving from master to my-branch
e3753a7 HEAD@{2}: rebase finished: returning to refs/heads/master
e3753a7 HEAD@{3}: pull --rebase: checkout e3753a71d92b032034dcb299d2df2edc09b5830e
b41ea52 HEAD@{4}: reset: moving to HEAD^
8400a0f HEAD@{5}: rebase: aborting
The first line indicates that a merge occurred. The 2nd line is the time before my merge. I simply git reset --hard 43b6032
to force this branch to track from before the merge, and carry-on.