Enforce the JIRA issue id in a GIT commit message
This can be done by using git hooks file location at .git/hooks/commit-msg. Following are the 2 way in whcih each Developers can set the Hooks in their developement envioronment.
Method – 1
[code]# commit-msg.sh
#!/bin/sh
# This hook will make sure that the commit message contains a JIRA issue.
#
# To enable this hook, rename this file to “.git/hooks/commit-msg”.
# Make sure to add execution permissions to the file.
export MESSAGE=$(<$1)
export JIRA_ISSUE_TAG=’ISSUETAG-([0-9]*)’
if [[ $MESSAGE =~ $JIRA_ISSUE_TAG ]]; then
echo -e “\e[32mGreat, your commit message contains a JIRA issue!\e[0m”
exit 0;
fi
echo -e “\e[31mOh hamburgers … You forgot to add a JIRA issue number!\e[0m”;
exit 1;
[/code]
Method 2 – This is another very good example to implement to force jira id in each commit message. http://nsbogan.com/tools/2015/06/04/jira-id-in-git-commit-messages
- Installing Jupyter: Get up and running on your computer - November 2, 2024
- An Introduction of SymOps by SymOps.com - October 30, 2024
- Introduction to System Operations (SymOps) - October 30, 2024