Created
March 6, 2015 22:47
-
-
Save mallocator/c10f0203d3b4a5de8b6e to your computer and use it in GitHub Desktop.
A commit-msg hook for git that will that will reject any commits where the commit message is not prefixed with an task label.
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/bash | |
# save the file as <git_directory>/.git/hooks/commit-msg.d/task and chmod +x | |
#Replace issue and word length(4) with your label to check for | |
if [ "${1:0:4}" = "TASK-" ]; then | |
#Allow maven release plugin to make commits even without a task id | |
if [ "${1:0:22}" != "[maven-release-plugin]" ]; then | |
echo >&2 Commit Message is missing a Task ID | |
exit 1 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment