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-123in 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.