Skip to content

Instantly share code, notes, and snippets.

@Suor
Last active August 29, 2015 14:15
Show Gist options
  • Save Suor/7a7e8976e4dd3982a29b to your computer and use it in GitHub Desktop.
Save Suor/7a7e8976e4dd3982a29b to your computer and use it in GitHub Desktop.
Never commit prints again
#!/bin/sh
PRINTS=`git diff --cached -U0 | grep ^+ | grep -E '\bprint(\b|_)'`
if [ -n "$PRINTS" ]; then
echo "ERROR: you are going to commit prints:\n"
git diff --cached -U0 -G'\bprint(\b|_)'
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment