Skip to content

Instantly share code, notes, and snippets.

@leolanese
Last active August 9, 2019 16:18
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 leolanese/f9d923bbf8004f1649faca68e23b08be to your computer and use it in GitHub Desktop.
Save leolanese/f9d923bbf8004f1649faca68e23b08be to your computer and use it in GitHub Desktop.
!nocommit
# include this into the file: .git\hooks\pre-commit
# pre-commit to avoid debugger
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
no_color='\033[0m'
if git commit -v --dry-run | grep 'debugger' >/dev/null 2>&1
then
echo -e "${red}-> ERROR: Trying to commit non-committable code!${no_color}"
echo -e "${red}Remove the debugger debugger and try again! \n${no_color}"
exit 1
else
echo -e "${green}Yay! commit was good! \n${no_color}"
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment