Git Diff and Vim

Now that I’ve seen the light and begun using git instead of subversion, I thought I’d post a follow up to my previous post about using vimdiff with subversion. That has by far been the most popular post on this site, so hopefully this will reach and help some of my fellow git users out there.

Setting up git to use vimdiff is virtually the same as with subversion. You need a vimdiff wrapper, and you need to tell git to use that wrapper as the diff program. First, the wrapper, gitvimdiff (anywhere in your path):

exec /usr/bin/vimdiff ${2} ${5}

After that, just need to edit your ~/.gitconfig file:

[diff]
  external = gitvimdiff
[pager]
  diff =

Big thanks to Jonathan Palardy for the info, I’ve just reproduced it here to help spread the word.

blog comments powered by Disqus