Created
January 26, 2017 04:44
-
-
Save cathyxz/ec682da1dbd285474013099becd49bab to your computer and use it in GitHub Desktop.
Pre-commit hook to reject commit if you have added console.logs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
count=`git diff HEAD | grep '+.*console\.log' | wc -l | awk '{print $1}'` | |
if [[ "$count" -ge 1 ]]; then | |
echo "Please remove console.log() statements from your changes before committing." | |
echo "Refusing to commit changes." | |
git diff HEAD | grep '+.*console\.log' | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment