Skip to content

Instantly share code, notes, and snippets.

@tehshane
Forked from kuy/pre-commit
Last active May 29, 2019 23:24
Show Gist options
  • Save tehshane/0b8970a764074bdeadd82b917c909a10 to your computer and use it in GitHub Desktop.
Save tehshane/0b8970a764074bdeadd82b917c909a10 to your computer and use it in GitHub Desktop.
git: pre-commit hook script to prevent committing FIXME code
#!/bin/sh
matches=$(git diff --cached | grep -E '\+.*?\/\/\s?(DEBUG|FIXME|debugger\;)')
if [ "$matches" != "" ]
then
echo "Detected possible debug-only code."
echo "Are you sure you want to commit it?"
echo " ${matches}"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment