Created
June 23, 2015 10:15
-
-
Save dataduke/b493f529e109cb0b26e4 to your computer and use it in GitHub Desktop.
git hook for checking a commit message
This file contains 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
#!/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