Latest Git:
git merge --abort
This attempts to reset your working copy to whatever state it was in before the merge. That means that it should restore any uncommitted changes from before the merge, although it cannot always do so reliably. Generally you shouldn't merge with uncommitted changes anyway.
Prior to version 1.7.4:
git reset --merge
This is older syntax but does the same as the above.
Prior to version 1.6.2:
git reset --hard
which removes all uncommitted changes, including the uncommitted merge. Sometimes this behaviour is useful even in newer versions of Git that support the above commands.
Answer from Daniel Cassidy on Stack OverflowLatest Git:
git merge --abort
This attempts to reset your working copy to whatever state it was in before the merge. That means that it should restore any uncommitted changes from before the merge, although it cannot always do so reliably. Generally you shouldn't merge with uncommitted changes anyway.
Prior to version 1.7.4:
git reset --merge
This is older syntax but does the same as the above.
Prior to version 1.6.2:
git reset --hard
which removes all uncommitted changes, including the uncommitted merge. Sometimes this behaviour is useful even in newer versions of Git that support the above commands.
Actually, it is worth noting 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 useful in everyday work.
How to undo a git pull that caused merge conflicts?
git - Restart/undo conflict resolution in a single file - Stack Overflow
Help fixing bad conflict resolution
How to undo a Git merge that hasn't been pushed yet?
I have a feature branch only I'm working on.
I made a merge from master into my feature branch, to keep it up-to-date, and accidentally solved conflicts wrong.
Kept working on my feature and pushed more changes. How can I revert things to: not bring in the bad "resolved conflicts" into my feature branch?
Essentially what I want to do is to make sure I am in my current branch in the following state:
1/ exactly as I was before I did the bad merge conflict resolution ;
And
2/ somehow I want to be able to, from the state I'll be after doing 1,still apply the changes I've done after my bad merge, maybe using a cherry pick on each individual commit or something...
I read that maybe an interactive rebase can be what I need but I've never done it.... Any help appreciated