Unfuddle STACK Tips & Tricks
How do I cancel a git merge?
git merge --abort to cancel a merge that had conflicts.
# Reset all the changes back to the last commit. # Note: This cannot be reverted! $ git reset --hard HEAD # OR $ git merge --abort
Please note that all the changes will be reset, and this operation cannot be reverted, so make sure to commit or
git-stash all your changes before you start a merge.
Uncommited changes may also create difficulties when trying to cancel the merge:
Warning: Running git merge with non-trivial uncommitted changes is discouraged: while possible, it may leave you in a state that is hard to back out of in case of a conflict.