Last active
August 16, 2019 01:27
-
-
Save leocaseiro/be1e82ebd68edf18f613433a68861672 to your computer and use it in GitHub Desktop.
Git commit-msg hook to check minimal 10 characters length for git commit message
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
#!/usr/bin/env bash | |
# Hook to make sure that no commit message line is lower then 10 characters | |
while read line; do | |
# Skip comments | |
if [ "${line:0:1}" == "#" ]; then | |
continue | |
fi | |
if [ ${#line} -le 10 ]; then | |
echo "Please enter a message with at least 10 characters." | |
echo "The following commit message has only ${#line} characters." | |
echo "Message: ${line}" | |
exit 1 | |
fi | |
done < "${1}" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment