Skip to content

Instantly share code, notes, and snippets.

@coaxial
Created August 13, 2014 18:30
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save coaxial/efa5b5a0a2893785e288 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Mostly from https://gist.github.com/alexbevi/3436040
# with help from http://codeinthehole.com/writing/tips-for-using-a-git-pre-commit-hook/
FILES_PATTERN='\.(rb|erb|haml|coffee)(\..+)?$'
FORBIDDEN='binding.pry'
git diff --cached --name-only | \
grep -E $FILES_PATTERN | \
GREP_COLOR='4;5;37;41' xargs grep --color --with-filename -n $FORBIDDEN && \
echo 'Stray debug statement found, commit rejected' && \
exit 1
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment