Created
September 24, 2024 23:58
-
-
Save fmoor/58240f600a95adb6c3708fcd4ff5a263 to your computer and use it in GitHub Desktop.
Prevent commiting TODO comments with a git hook
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
#!/usr/bin/env bash | |
# https://stackoverflow.com/a/7292992 | |
# https://git-scm.com/docs/git-sh-setup | |
. "$(git --exec-path)/git-sh-setup" | |
if git diff-index -p -M --cached HEAD -- \ | |
| grep ^+ \ | |
| grep --ignore-case TODO | |
then | |
die "Blocking commit because string \`todo\` detected in patch." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment