Skip to content

Instantly share code, notes, and snippets.

@carpeliam
Forked from eedrummer/pre-commit
Last active August 29, 2015 14:06
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 carpeliam/a2ef3f5a8dd245fb0f34 to your computer and use it in GitHub Desktop.
Save carpeliam/a2ef3f5a8dd245fb0f34 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# To enable this hook, rename this file to "pre-commit".
PRY_PATTERN="require.+[\'\"]pry[\'\"]|binding\.pry"
# Redirect output to stderr.
exec 1>&2
if git diff --cached | grep '^\+' | grep -q -E $PRY_PATTERN; then
echo "ERROR: There is left over pry stuff in this commit"
git diff --cached --name-only | xargs grep -n -H -E $PRY_PATTERN
exit 1 # reject
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment