Bailing out of an in-progress git merge
Git has a number of features that have been around for some time, yet many people seem unaware of. git merge --abort
seems to fall into this category. It was introduced in version 1.7.4 (35d2fff), which was released January 30, 2011.
git merge --abort
brings further consistency of how to back out of certain operations (git rebase --abort
, git am --abort
, …).
Some times you’ll come to the decision that the merge in progress (conflicted, or just --no-commit
) shouldn’t be finished. git merge --abort
is likely what you’re looking for. This will first check to make sure that you’re actually in the middle of a merge (.git/MERGE_HEAD
exists), then run git reset --merge
for you (the previous way to do this, available since 1.6.2).
While this doesn’t do much of anything that wasn’t available before, it’s nice to have the action available in a form consistent with more well advertised “just make it like it was before” commands (such as git rebase --abort
).