I've been doing some collaborative hacking on a paper. This makes git's git diff --color-words option very useful. Getting git's repository viewer, gitk, to use this option was not easy, and the result is not terribly satisfying given the poor integration. But, it is functional and a lot easier to use then manually copying SHA1 IDs.

After poking around gitk's menus, I saw it can use an external diff program. Unfortunately, this is only used when right clicking on a file in the bottom-right panel and selecting external diff; it is not used for generating the diffs in the lower-left panel. Further, gitk does not actually use the output from this program: it expects the extral program to show the output itself; git diff just sends the output to stdout. The following program works around these limitations: it launches git diff in an xterm and sends the output to less:

#!/bin/bash

# git diff will happy work on files.  If you do not run it from a
# directory managed by git.
D=`pwd`
cd /

xterm -e bash -c "git diff --color-words -- \"$D/$1\" \"$D/$2\" | less -R"