Created
October 16, 2016 20:18
-
-
Save neur0manc/cce44e57638d34dd7afcde6adc1f72d8 to your computer and use it in GitHub Desktop.
Git-Hook to prevent committing code that still contains TODOs
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/bash | |
# | |
# Link this to .git/hooks/pre-commit | |
# and make sure this script is executable | |
# (I use `bash` instead of `sh` so I can color the error message) | |
result=$(grep -REin "// TODO|//TODO" * --exclude pchook.sh) | |
rc=$? | |
if [ $rc -eq 0 ]; then | |
echo -e "\e[31mDon't commit TODOs\e[0m" | |
echo "$result" | |
exit 1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment