Last active
April 17, 2018 10:48
-
-
Save burtyish/0428aac0d62a7980d84d33f6909ea176 to your computer and use it in GitHub Desktop.
pre-push git hook, prevents pushing if any new `TODO`s were added
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/sh | |
# Place this file in the `.git/hooks` directory | |
HITS=0 | |
for FILE in `git diff origin/HEAD --name-only`; do | |
grep 'TODO' $FILE 2>&1 >/dev/null | |
if [ $? -eq 0 ]; then | |
echo 'New TODO found in file: ' $FILE | |
((HITS++)) | |
exit 1 | |
fi | |
done | |
exit $HITS |
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
# Add these lines to a new/existing pre-push file in your `.git/hooks` directory | |
set -e | |
.git/hooks/no-todos.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment