Skip to content

Instantly share code, notes, and snippets.

@maxandron
Last active March 21, 2016 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxandron/e2016373bed0048555bf to your computer and use it in GitHub Desktop.
Save maxandron/e2016373bed0048555bf to your computer and use it in GitHub Desktop.
A git pre-commit hook to disallow committing code with "TODO"
#!/bin/sh
. git-sh-setup # For die
git diff --cached --name-status |
awk '$1 != "R" { print $2 }' |
xargs grep TODO --with-filename --line-number &&
die Blocking commit - TODO detected in patch
exit 0 # Needed because this file must end with success code for git to continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment