« best of ben | Main | missing out on flex? »

graphical diff for git on mac os x

I just configured git to use FileMerge for diffs. FileMerge is a pretty graphical diff tool. I couldn't find quite the right invocation via google, so here's what I did:

  1. Create ~/bin/git-diff-driver.sh with these contents:
    /usr/bin/opendiff "$2" "$5"

  2. Make it executable
    chmod ugo+x ~/bin/git-diff-driver.sh

  3. Make git use this little script for diffs. Edit ~/.gitconfig to include these lines:
    external = "/Users/ben/bin/git-diff-driver.sh"

Now the next time that you call git diff HEAD FileMerge will open. GUI sweetness.

Reader Comments (1)

Thanks for this! Works great - though your line in .gitconf only works for people called ben! ;-)

9.22.2009 at 03:11 AM | Unregistered CommenterAnonymous

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>