Last active
August 9, 2019 16:18
-
-
Save leolanese/f9d923bbf8004f1649faca68e23b08be to your computer and use it in GitHub Desktop.
!nocommit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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