bob.sacamento bob.sacamento - 1 year ago 201
Git Question

git -- how to recover from unfinished merge

I started the mergetool ...

> git mergetool

And it said something like ...

merge tool candidates: blah blah blah

And then I thought, "You know, I'm not ready for this." Not knowing any clean way to shut it down, I hit ctrl-C. Now I want to check out another branch, but I can't ...

> git checkout other_branch
error: path 'file1.c' is unmerged

Is there some way to recover from this? I emphasize that I made no actual changes when mergetool was running.

Answer Source

You're looking for the --abort option which exists in most git commands:

git merge --abort

Manual entry:

Abort the current conflict resolution process, and try to reconstruct the pre-merge state.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download