Skip to content

Instantly share code, notes, and snippets.

@DiegoSalazar
Created February 3, 2012 00:17
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 DiegoSalazar/1726679 to your computer and use it in GitHub Desktop.
Save DiegoSalazar/1726679 to your computer and use it in GitHub Desktop.
pre-commit hook to alert if a certain string found in code
#!/bin/sh
RED="\033[0;31m"
WHITE="\033[1;37m"
if git diff-index -p -M --cached HEAD | grep '#debug' > /dev/null; then
#echo 'debug lines found in commit. Aborting' >&2
#exit 1
echo "\n\t${RED}You left a debug comment in the code!${WHITE}\n" >&2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment