We’re using Bitbucket Server and Jira for our git projects. They’re linked through Bitbucket’s Application Links feature. We’ve noticed that Bitbucket seems to find Jira issue references throughout the entire commit message, not just the first line.
For example, if we have a commit message like this:
PROJ-123: Fix bug in login page
This commit addresses the issue reported in PROJ-123.
It also touches on some code related to PROJ-456.
Bitbucket links this commit to both PROJ-123 and PROJ-456. But we’d prefer if it only linked to PROJ-123, which is in the first line.
Is there a way to make Bitbucket only look for Jira issues in the first line of commit messages? We’d like to mention other issues in the body without creating unwanted links.
Has anyone found a setting in Bitbucket or Jira to control this behavior? We’re using the server versions, but info about cloud or data center versions would be helpful too.
yeah, ive run into this too. its a pain. what we do is use square brackets around issue keys in the body, like [PROJ-456]. bitbucket doesnt pick those up as links. takes some gettin used to, but works pretty well. might be worth a shot for ur team if u dont wanna mess with hooks n stuff.
I’ve encountered a similar situation in my work with Bitbucket and Jira. Unfortunately, there’s no built-in setting to restrict Jira issue detection to just the first line of commit messages. Bitbucket’s designed to scan the entire message for issue keys.
A workaround we’ve used is to establish a team convention for commit messages. We agreed to only include the primary issue key in the first line and use a different format for mentioning other issues in the body, like [PROJ-456] instead of PROJ-456.
This approach requires team buy-in and occasional reminders, but it’s been effective for us. It allows us to reference multiple issues without creating unintended links while maintaining a clean commit history.
If you’re open to using external tools, there are Git commit hooks that can enforce this kind of formatting automatically. It’s a bit more technical to set up, but it can save a lot of headaches in the long run.
I’ve dealt with this issue in my organization as well. Unfortunately, Bitbucket doesn’t offer a native solution to limit issue detection to the first line. We found that using a custom Jira issue key format in the commit body helps. For instance, we use {PROJ-456} instead of PROJ-456 when referencing secondary issues.
This approach requires some team training, but it’s effective. We also implemented a pre-commit hook to validate our commit message format. It checks that only one standard Jira key appears in the first line and flags any incorrect usage in the body.
While not perfect, this method has significantly reduced unintended issue linking in our Bitbucket-Jira integration. It maintains clean tracking without limiting our ability to reference multiple issues when necessary.