Skip to content

Instantly share code, notes, and snippets.

@adamcheasley
Forked from chronossc/pre-commit
Created June 23, 2017 10:34
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 adamcheasley/f385aef3b0077854c6d11ce375295b48 to your computer and use it in GitHub Desktop.
Save adamcheasley/f385aef3b0077854c6d11ce375295b48 to your computer and use it in GitHub Desktop.
Basic pre-commit hook for avoid commit code with pdb/ipdb
#!/bin/bash
# based on http://www.snip2code.com/Snippet/165926/Check-for-ipdb-breakpoints-git-hook
pdb_check=$(git grep -E -n '[ ;]i?pdb')
if [ ${#pdb_check} -gt 0 ]
then
echo "COMMIT REJECTED: commit contains code with break points. Please remove before commiting."
echo $pdb_check
exit 1
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment