Skip to content

Instantly share code, notes, and snippets.

@leocaseiro
Last active August 16, 2019 01:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leocaseiro/be1e82ebd68edf18f613433a68861672 to your computer and use it in GitHub Desktop.
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
#!/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