Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
git pre commit hook
#!/bin/bash
## START PRECOMMIT HOOK
# git commit .... <-- run with check
# NOCHECK=1 git commit ... <-- run without check
if [ ! "${NOCHECK}" ]; then
files_modified=`git status --porcelain | egrep "^(A |M |R ).*" | awk ' { if ($3 == "->") print $4; else print $2 } '`
for f in $files_modified; do
echo "Checking ${f}..."
if grep --color -n "console.log" $f; then
echo "File ${f} failed - found 'console.log'"
exit 1
fi
if grep --color -n "binding.pry" $f; then
echo "File ${f} failed - found 'binding.pry'"
exit 1
fi
done
fi
exit
## END PRECOMMIT HOOK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.