Created
January 11, 2013 19:39
-
-
Save malexw/4513374 to your computer and use it in GitHub Desktop.
When installed as a git pre-commit hook, this script will prevent a commit from being created if the token '!DNC' is found within the diff.
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 | |
exec 1>&2 | |
dnc_count=$(git diff --cached | grep -c '!DNC') | |
if [ "$dnc_count" != "0" ] | |
then | |
echo "Aborting commit. Found" $dnc_count "!DNC markers" | |
exit $dnc_count | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment