Skip to content

13.1. Vimdiff with git

shinokada edited this page Oct 6, 2014 · 1 revision

~/.gitconfig

[diff]
        tool = vimdiff
[merge]
        tool = vimdiff
        conflictstyle = diff3
[difftool]
        prompt = false
[mergetool]
        keepBackup = false
[difftool "sourcetree"]
        cmd = opendiff \"$LOCAL\" \"$REMOTE\"
        path = 
[mergetool "sourcetree"]
        cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
        trustExitCode = true

Starting git mergetool

git mergetool -t vimdiff

Move your cursor to a merge conflict area and then:

:diffg RE  "get from REMOTE
:diffg BA  "get from BASE
:diffg LO  "get from LOCAL

:wqa "to quit all files
git commit

Resource

Vim wiki

Use vimdiff as git mergetool

Clone this wiki locally