Skip to content

Instantly share code, notes, and snippets.

@dataduke
Created June 23, 2015 10:15
Show Gist options
  • Save dataduke/b493f529e109cb0b26e4 to your computer and use it in GitHub Desktop.
Save dataduke/b493f529e109cb0b26e4 to your computer and use it in GitHub Desktop.
git hook for checking a commit message
#!/bin/sh
# move to /.git/hooks/commit-msg
#
# check for regex pattern
PATTERN="[A-Z]{2,}_[0-9]{1,6}"
head -n1 "$1" |grep -qsE ${PATTERN} || {
echo >&2 Include pattern in your commit message. Example: ABCD_1234.
exit 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment