Last Updated: February 25, 2016
·
2.153K
· destructuring

git mergetool with vimdiff

Better have a large display when you run this after a merge with conflicts. It opens up to four windows to show the base version, the two local and remote conflicting versions, and the version you are editing. I don't think I'll ever go back to editing the conflicted file directly unless its super simple.

git mergetool --tool=vimdiff

You can set vimdiff as the default with:

git config --global merge.tool vimdiff

which looks like this in ~/.gitconfig:

[merge]
    tool = vimdiff

Probably want to turn off prompting, too:

git config --global mergetool.prompt false

which looks like this in ~/.gitconfig, notice the different section:

[mergetool]
    tool = vimdiff

There's a similar git command, difftool, to play with, too:

git config --global diff.tool vimdiff
git config --global difftool.prompt false
git difftool HEAD~1