Tuesday, June 2, 2009

Git & Whitespace

Recently I've been slowly transitioning from svn to git, though one of the mildly annoying differences is that git likes to colorize trailing whitespace in diffs with a very distracting color:

First try at fixing it: a tiny script to fix the file before committing.

Oops, that introduced a huge number of changes and would mess up history quite a bit, not the way to go.

So I added this to my ~/.gitconfig:

whitespace = -trailing-space

and now I can see the important changes in the diffs again.

1 comment:

  1. You can also enable the sample pre-commit hook that will help fix the whitespace 'errors' before the commit as well.