-
-
Save mgershovitz/ea9ab197b8129d4c8c0aee15c2658bc4 to your computer and use it in GitHub Desktop.
Git pre-commit hook to prevent accidentally committing debug code (add NO_COMMIT in source comment)
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/bash | |
if git diff --cached | grep '^[+d].*NO_COMMIT'; then | |
echo "Can't commit file with NO_COMMIT comment, remove the debug code and try again" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment