Skip to content

Instantly share code, notes, and snippets.

@floscher
Created January 25, 2015 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floscher/ad41bac476bdcc2dee2f to your computer and use it in GitHub Desktop.
Save floscher/ad41bac476bdcc2dee2f to your computer and use it in GitHub Desktop.
update-hook for
#!/bin/bash
# This hook checks for whitespace problems and rejects pushing them (even with --force).
# Put this in the ./hooks/ directory on your (server-)repository.
# With the core.whitespace-attribute in your git-configuration you can control for which
# problems it should check (see http://www.git-scm.com/docs/git-config for possible values).
echo "Checking for whitespace problems introduced between $2 and $3"
git diff --check $2 $3
exit `git diff --check $2 $3 | wc -l`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment