Jira: assign an existing git branch to an issue
Solution 1:
ex-Stash developer here.
Yes and no. Creating the branch though the UI is just a convenience. The important thing is that the name contains the JIRA key. If only one developer is working on the branch, it's fairly easy to just rename (delete + add) a branch with the appropriate name.
git checkout old-branch
git push -u origin old-branch:JIRAKEY-1234-something
git push origin :old-branch
Does that help?
Solution 2:
Update
As for january 2017 if you have an already exiting branch and you want to attach it to a Jira Issue you can do the following:
- Checkout to the branch you want to rename
-
Execute the following command
git branch -m JIRA_ISSUE_ID-Whatever
Assuming that mine Jira issue is SO-01
I can do the following:
git branch -m SO-01-Whatever
This will change the name locally, push it to remote with:
git push origin :old_name
Command Syntax
git branch (-m | -M) [<oldbranch>] <newbranch>
Related question for more info
Solution 3:
This is no longer the case. With a common setup between bitbucket and Jira, simply including the issue ID in the commit message will create a link between the commit, and thus the branch, and the issue in Jira.