Skip to content

Instantly share code, notes, and snippets.

@eedrummer
Created November 19, 2012 20:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save eedrummer/4113624 to your computer and use it in GitHub Desktop.
Save eedrummer/4113624 to your computer and use it in GitHub Desktop.
Git pre-commit hook to detect the presence of pry related statements
#!/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