Enforcing JIRA IDs in Commits and Merge Requests
Introduction
Section titled โIntroductionโLinking code changes to JIRA issues helps track work and improves auditability.
Enforce via Push Rules
Section titled โEnforce via Push Rulesโ- Navigate to Settings > Repository > Push Rules.
- In Commit message must match this regular expression, enter a pattern that includes your JIRA project key, e.g.,
^[A-Z]+-\d+: .+
- Save the rule. Commits without a JIRA ID will be rejected.
Enforce in Merge Requests
Section titled โEnforce in Merge Requestsโ- Use merge request templates that remind contributors to include
JIRA-123
in the title or description. - Combine with approval rules so Maintainers verify the JIRA link before approving.
Best Practices
Section titled โBest Practicesโ- Educate developers on the required format.
- Provide scripts or commit templates to insert the issue ID automatically.
- Use branch naming conventions like
feature/JIRA-123-description
.