使用 vimdiff 作 git 合并工具的技巧

{撰文/vern}

编辑 ~/.gitconfig 文件

[merge]
tool = whatever_you_want
[mergetool "whatever_you_want"]

cmd = "gvim --noplugin --remote-tab-silent \"+set

buftype=nowrite\"
\"$PWD/$MERGED\" && sleep 1;\

gvim --remote-send \":split $PWD/$REMOTE:set

buftype=nowrite:vertical diffsplit $PWD/$LOCAL:vertical diffsplit
$PWD/$BASE:set buftype=nowritel\""

cmd = "gvim --noplugin \"$PWD/$MERGED\" \

+\":split $PWD/$REMOTE\" +\":set buftype=nowrite\" \

+\":vertical diffsplit $PWD/$LOCAL\" +\":set buftype=nowrite\"

\

+\":vertical diffsplit $PWD/$BASE\" +\":set buftype=nowrite\"

\

+\":wincmd l\""

cmd = "vim --noplugin \"$PWD/$MERGED\" \
+\":split $PWD/$REMOTE\" +\":set buftype=nowrite\" \
+\":vertical diffsplit $PWD/$LOCAL\" +\":set buftype=nowrite\" \
+\":vertical diffsplit $PWD/$BASE\" +\":set buftype=nowrite\" \
+\":wincmd l\""

运行 git mergetool 后的截图

vimdiff

参考 merging-with-git

Read More: