Skip to content

Instantly share code, notes, and snippets.

@icebreaker
Created August 4, 2011 05:49
Show Gist options
  • Select an option

  • Save icebreaker/1124576 to your computer and use it in GitHub Desktop.

Select an option

Save icebreaker/1124576 to your computer and use it in GitHub Desktop.
A pre-commit hook to "prevent mistakes" based on Mark's idea.
#!/bin/sh
EXIT=0
for f in `git diff-index --name-status HEAD | cut -c3-`; do
if [ "grep -n 'debugger' $f" ]; then
echo "$f contains debugger"
EXIT=1
fi
done
exit $EXIT
# chmod +x .git/hooks/pre-commit
# Original version: http://mark-story.com/posts/view/using-git-commit-hooks-to-prevent-stupid-mistakes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment