gitubuntuvimmergevimdiff

How to successfully exit "vimdiff" (which is used as a merge tool for "git") without saving?


I am new to this, so apologies about the basic question.

I am using an Ubuntu environment. I have git installed. I setup vimdiff as the merge tool.

I am testing the environment, but I am having a problem.

I created a conflict in a readme.txt file. The conflict obviously happens when I try to merge from the branch develop to master. As expected, some "markup characters" are added to readme.txt to indicate where the conflicts happen. So, the next step is to call git mergetool which launches vimdiff.

So far, everything is working as expected, and vimdiff is now launched. But then, I decided to exit vimdiff without making any changes. I wanted to "postpone" my changes till another time. So, I press <ESC> followed by :qa!, thinking this will stop the merge process. Unfortunately, this is not what happened. It looks like that the merge is now considered resolved and successful, and the readme.txt file, although did not change, and although contains the conflicts markup, is now ready to be committed.

Now to my question. How can I terminate the git mergetool call, exit vimdiff, and start over, as if I did not make the call?

Thanks.


Solution

  • Use :cquit, or git merge --abort and do the merge again.