Simple git commit-msg hook to ensure that commit messages contain Jira issue id's
- Python 2.6
Copy the following files to the .git/hook directory in the repository you are going to use the commit-msg hook.
commit-msg
jira-commit-msg.py
Both files have to be executables.
chmod +x filename
Currently the naming standard is based on a simple regex.
A sample commit message should look like this
JIRA-ISSUE. Message.
eg.
DDC-1234. Sample commit message.
To customize the message validation to your liking simply modify the existing regular expressions in jira-commit-msg.py
MESSAGE_REGEX = '^DDC-[\d]{4}\. [\w\d .,:;+]*\.$'
BRANCHNAME_REGEX = '/(DDC-[\d]{4})-' #should contain a capturing group
To test your regex you can simply do so here
git-commit-msg is released under the MIT license.