Last active
August 14, 2016 05:18
-
-
Save musically-ut/7bcd78cce3aa226d7f62ce71555ee010 to your computer and use it in GitHub Desktop.
Pre-commit hook to avoid committing lines with '#NO-GIT"
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 | |
PAT='#\s*NO(.)?GIT' | |
git diff --cached --name-only | \ | |
xargs egrep -i --color --with-filename -n "$PAT" && echo "Found '"$PAT"' in code about to be committed. Rejecting commit." && exit 1 | |
# Exit with error code zero if all went well. | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment