Skip to content

Instantly share code, notes, and snippets.

@cddr
Created September 13, 2013 20:03
Show Gist options
  • Save cddr/6555387 to your computer and use it in GitHub Desktop.
Save cddr/6555387 to your computer and use it in GitHub Desktop.
Fixes whitespace only on the lines I've changed
# Really dumb script to fix up whitespace but only on the lines changed in the current
# commit. Run this script from your $PROJECT/.git/hooks/pre-commit
#
git diff HEAD --no-color > /tmp/stage.diff
git apply -R /tmp/stage.diff
git apply --whitespace=fix /tmp/stage.diff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment