Skip to content

Instantly share code, notes, and snippets.

@brianng
Created August 1, 2014 17:28
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 brianng/cbd9372ddd6fbb70ce20 to your computer and use it in GitHub Desktop.
Save brianng/cbd9372ddd6fbb70ce20 to your computer and use it in GitHub Desktop.
Simple git pre-commit hook to detect console.log statements
#!/bin/sh
git diff --cached | grep --quiet "^+.*console\.log"
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo "Error: detected console.log statement"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment