Search code examples
gitvimdiffmergetool

git vimdiff mergetool basic commands?


I have executed git mergetool to try to resolve some merge conflicts.

It opens 3 text windows (within my SSH terminal) with different versions of code in each.

The code I want is in the window on the right.

How do I tell git to take this version and move on?

Here's the screen shot...enter image description here


Solution

  • According to this blogpost:

    There are two basic strategies for reconciling a 3-way diff. You can either keep your cursor in the middle file, and run :diffget with the bufspec for the file containing the change you want to keep. Or you can position your cursor on the change that you want to keep, and run :diffput with the bufspec for the working copy file.

    Now, a bufspec is a buffer number, a pattern for a buffer name or a part of a buffer name, like "v2" in "file.cpp.v2". If you type 2 plus CTRL+G, it shows you the buffer number and file.