20

What's the difference between them? My search engine results talk only about vimdiff, yet the command

git mergetool 

offers me both.

nomadStack
  • 405
  • 2
  • 4
  • 11

1 Answers1

20

vimdiff2 was introduced in commit 0008669 (Sept 2010, for git 1.7.4)

It is like vimdiff, but with different merge options (as commented in commit b2a6b71, git 1.8.2: "vimdiff and vimdiff2 differ only by their merge command").

It (vimdiff2) forces a 2-way merge, versus vimdiff which will use a 3-way merge if the base (common ancestor) is detected:

gvimdiff|vimdiff)
    if $base_present
    then
        "$merge_tool_path" -f -d -c 'wincmd J' \
            "$MERGED" "$LOCAL" "$BASE" "$REMOTE"
    else
        "$merge_tool_path" -f -d -c 'wincmd l' \
            "$LOCAL" "$MERGED" "$REMOTE"
    fi
    ;;
gvimdiff2|vimdiff2)
    "$merge_tool_path" -f -d -c 'wincmd l' \
        "$LOCAL" "$MERGED" "$REMOTE"
    ;;

Note that commit 7c147b7 (April 2014, for Git 2.1.0 August 2014) actually introduces vimdiff3 as well:

It's similar to the default, except that the other windows are hidden.
This ensures that removed/added colors are still visible on the main merge window, but the other windows not visible.

Specially useful with merge.conflictstyle=diff3.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • What would you recommend for resolving merge conflicts? "Unfortunately Vim struggles a bit with three-way diffs, both with highlighting the differences and with shuffling individual changes between the three windows." Source: http://vim.wikia.com/wiki/A_better_Vimdiff_Git_mergetool – nomadStack Jan 13 '15 at 13:40
  • @nomadStack indeed. I prefer to use kdiff3. – VonC Jan 13 '15 at 13:56