Skip to content

Instantly share code, notes, and snippets.

@nethad
Last active December 29, 2015 13:09
Show Gist options
  • Save nethad/7674981 to your computer and use it in GitHub Desktop.
Save nethad/7674981 to your computer and use it in GitHub Desktop.
git pre-commit hook for illegal code lines
# git-hooks/pre-commit/binding-pry.sh
FOCUS_FILES=`git diff-index --cached --name-only HEAD | xargs grep 'binding.pry' | wc -l`
if [ $FOCUS_FILES -gt 0 ]
then
echo "[pre-commit] You have at least 1 file with a 'binding.pry' call, please remove first."
exit 1
fi
# .git/hooks/pre-commit
#!/usr/bin/env sh
source ~/path/to/your/git-hooks/pre-commit/binding-pry.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment