-
-
Save dperrymorrow/2933611 to your computer and use it in GitHub Desktop.
git commit hooks
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
$ cat .git/hooks/pre-commit | |
#!/bin/sh | |
DIFF=`git diff HEAD`+`git diff --cached HEAD` | |
if [[ "$DIFF" == *"DO NOT COMMIT"* ]] | |
then | |
echo "Error; Attempt to commit a delta including the phrase 'DO NOT COMMIT'"; | |
echo | |
echo "Use --no-verify to bypass this check." | |
echo | |
exit 1 | |
fi | |
if [[ "$DIFF" == *"<<<<<<<"* ]] | |
then | |
echo "Error; Looks like you have a bad merge - due to the phrase '<<<<<<<'"; | |
echo | |
echo "Use --no-verify to bypass this check." | |
echo | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment