I have a situation with my Jira setup that’s connected to our git repository.
Usually when we start working on a ticket, we use the ‘create branch’ button in Jira which automatically links the branch to the issue. This makes it easy to see all the commits related to that specific ticket.
However, one of our team members already created a branch and started coding before realizing there was an existing Jira issue for this work. Now we have commits on a branch that isn’t connected to the ticket.
Is there a way to connect this existing branch to the Jira issue after the fact? I want to make sure we can still track the commit history properly in the issue view.
Any suggestions on how to establish this connection would be helpful.
To link your existing Git branch to a Jira ticket, you can rename the branch to follow your team’s Jira naming convention. For example, if your ticket number is PROJ-123, you might rename your branch to something like PROJ-123-feature-description. This can be done using the command git branch -m old-branch-name PROJ-123-new-descriptive-name
. After renaming, push the branch to the remote repository and delete the old branch if necessary. Jira will automatically recognize the branch due to the ticket number in the new name, allowing you to maintain commit history while ensuring proper tracking in the issue view.
Just add the Jira ticket number to your commit messages on that branch. Most Jira integrations automatically pick up commits when you format them like “PROJ-123: description of changes”. If you need to fix existing commit messages, you can use git rebase - but be careful if others have already pulled the branch. Also, check your Jira integration settings. Some let you manually link branches through the development panel in the issue view. This keeps your current branch name but still connects your commits to the ticket for tracking.
Check if your Jira admin set up webhooks or branch linking rules. Sometimes you can just edit the branch description in GitHub/Bitbucket and add the ticket ID there. Our setup picks up branches when we mention ticket numbers anywhere in the branch metadata - doesn’t have to be in the name itself.