What's the difference between them? My search engine results talk only about vimdiff, yet the command
git mergetool
offers me both.
In Vim, open a file with conflict markers, and start mergetool. vim-mergetool would show 2-way diff in a new tab with $MERGED file on the left. By default, all conflicts are already resolved by picking up ours/LOCAL version. You don't need to edit raw conflict markers manually.
Resolving merge conflict with vimdiff Save the file and quit (a fast way to write and quit multiple files is :wqa ). Run git commit and you are all set!
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With