Skip to content

Instantly share code, notes, and snippets.

@yeisoncruz16
Created September 22, 2020 15:43
Show Gist options
  • Save yeisoncruz16/f70232757e513cf6177765a739bbfd45 to your computer and use it in GitHub Desktop.
Save yeisoncruz16/f70232757e513cf6177765a739bbfd45 to your computer and use it in GitHub Desktop.
simple commit message hook to validate message contain :
#!/bin/bash
MSG="$1"
message="Hey! looks like your commit message is not following correct format"
if ! grep -qE ":" "$MSG";
then
printf "\n";
echo -e "\e[91m${message}\e[0m";
echo "Your commit message: " && cat "${MSG}";
printf "\n";
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment