Last active
March 26, 2016 17:54
-
-
Save ross-nordstrom/96d631f57c85b786c1ca to your computer and use it in GitHub Desktop.
Prevent commits with keywords you shouldn't ever have in production code. Just put this file under `<repo>/.git/hooks/pre-commit`
This file contains hidden or 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 | |
for FILE in `git diff-index --name-only HEAD --` ; do | |
# Check if the file contains 'debugger' | |
if cat $FILE | grep -q 'debugger' $FILE; then | |
echo $FILE ' contains debugger!' | |
exit 1 | |
fi | |
# Check if the file contains 'console.log' | |
if cat $FILE | grep -q 'console.log' $FILE; then | |
echo $FILE ' contains console.log!' | |
exit 1 | |
fi | |
# Check if the file contains 'describe.only' | |
if cat $FILE | grep -q 'describe.only' $FILE; then | |
echo $FILE ' contains describe.only!' | |
exit 1 | |
fi | |
# Check if the file contains 'it.only' | |
if cat $FILE | grep -q 'it.only' $FILE; then | |
echo $FILE ' contains it.only!' | |
exit 1 | |
fi | |
done | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment