Skip to content

Instantly share code, notes, and snippets.

@malexw
Created June 4, 2015 21:36
Show Gist options
  • Save malexw/de4ec5ba3b07beb6322a to your computer and use it in GitHub Desktop.
Save malexw/de4ec5ba3b07beb6322a to your computer and use it in GitHub Desktop.
Reject git commits that have a commit message greater than 50 characters
#!/bin/sh
exec 1>&2
char_count=$(cat $1 | wc -m)
if [ "$char_count" -gt "50" ]
then
echo "Aborting commit. Commit message too long (" $char_count "/ 50 chars )"
exit $char_count
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment