https://docs.gitlab.com/ee/user/project/integrations/jira.html#configuring-gitlab
- Create a Jira user/pass
- For each GitLab project setup the Jira Integration (Settings -> Integrations)
- Commit message now starts with
PROJ-12
prefix
Example commit hook:
#!/usr/bin/env bash
INPUT_FILE=$1
START_LINE=`head -n1 $INPUT_FILE`
PATTERN="^(PROJ)-[[:digit:]]+: "
if ! [[ "$START_LINE" =~ $PATTERN ]]; then
echo "Bad commit message, see example: PROJ-12: commit message"
exit 1
fi