git – I ran into a merge conflict. How can I abort the merge? – Stack Overflow
Posted by jpluimers on 2020/11/25
Since I keep forgetting how simple it is: [WayBack] git – I ran into a merge conflict. How can I abort the merge? – Stack Overflow
If your git version is >= 1.6.1, you can use
git reset --merge.Also, as @Michael Johnson mentions, if your git version is >= 1.7.4, you can also use
git merge --abort.As always, make sure you have no uncommitted changes before you start a merge.
From the git merge man page:
git merge --abortis equivalent togit reset --mergewhenMERGE_HEADis present.
MERGE_HEADis present when a merge is in progress.Also, regarding uncommitted changes when starting a merge:
If you have changes you don’t want to commit before starting a merge, just
git stashthem before the merge andgit stash popafter finishing the merge or aborting it.
–jeroen






Leave a comment