Vimdiff is an amazing tool to work with file differences and it particuarly suitable for use when examining differences between git revisions. There is a command built in to git that is called git-difftool. It allows you to use an external tool to look at your diffs this tip just shows how I like to configure git-difftool.
You can have a look at the possible tools to use by typing
$ git difftool --tool-help On my system this gives
'git difftool --tool=<tool>' may be set to one of the following:
The following tools are valid, but not currently available:
Some of the tools listed above only work in a windowed
environment. If run in a terminal-only session, they will fail.
I like to make vimdiff the default diffing tool for the text environment and gvimdiff if I want a gui.
$ git config --global diff.tool vimdiff
$ git config --global digg.guitool gvimdiff
By default git-difftool prompts before launching the diff tool. Which is annoying, so I like to disable it with
$ git config --global difftool.prompt 0
Now I can use git-difftool thus, assuming I am in a directory tht is under version control by git
$ git difftool . If I want to launch it graphically I can add -g to the command like this
git difftool -g .
Now, typing difftool is rather longwinded, so I like to make a couple of quick aliases for convenience
$ git config --global alias.vd difftool
$ git config --global alias.gv 'difftool -g' Now that is all set up I can review my changes with a simple
$ git gv Sorted.