Skip to content

Instantly share code, notes, and snippets.

@insoul
insoul / pre-commit
Last active August 29, 2015 13:57
git pre-commit hook to protect debugging code and syntax error
#!/usr/bin/env bash
changed_files=`git status --short | grep '^[AMCU]' | awk '{print $2}' | grep -P '\.(rb|erb)'`
if [ -z "$changed_files" ]; then
exit 0
fi
while read -r file; do
result=`grep -rin 'binding.pry\|debugger' $file`