Skip to content

Instantly share code, notes, and snippets.

@wickdninja
Created March 23, 2017 13:10
Show Gist options
  • Save wickdninja/4d20d88a1b22ceb6f59982d1e5d07197 to your computer and use it in GitHub Desktop.
Save wickdninja/4d20d88a1b22ceb6f59982d1e5d07197 to your computer and use it in GitHub Desktop.
Require Jira Ticket in commit message
#!/bin/sh
# Require Jira Ticket in commit message
KEY="ABP-"
WARNING="Jira ticket reference NOT FOUND but is required!"
MESSAGE=$(<$1)
case "$MESSAGE" in
$KEY*)
exit 0;
;;
*$KEY*)
WARNING="Jira reference MUST be the 1st token in your message!"
;;
esac
echo $WARNING
echo "Example"
echo "git commit -m 'ABC-1234 #resolve #time 3h 20m'"
exit -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment