Jira is used by developers as a project management tool to track and prioritize work items, while Bitbucket is used as a Git repository management solution to store and manage source code. By integrating these two tools, developers can benefit from the ability to track code changes and tasks in one place, improving their workflows and collaboration within their teams.
One of the best ways to seamlessly integrate Bitbucket and Jira is with Git Integration for Jira, a top Atlassian marketplace app built by GitKraken. With this integration, developers can concentrate on their core responsibilities without having to constantly switch between tools, and project managers are afforded additional insight into the status of key projects.
In this article we’ll cover the following topics related to Integrating Bitbucket with Jira:
Jira Bitbucket Integration Benefits
Linking Bitbucket with Jira Issues
Create Bitbucket Branch in Jira
Create Bitbucket Pull Request in Jira
Jira Bitbucket Integration Benefits
Integrating Bitbucket and Jira through Git Integration for Jira offers separate advantages for both developers and project managers.
Top Benefits For Developers
- Elimination of context switching: integrating Bitbucket and Jira allows developers to track code changes and work items in one central location, eliminating the need to switch between different tools and improving their workflow.
- Improved collaboration: by bringing these two tools together, developers can more easily share code and work with their team, fostering better communication and collaboration.
Top Benefits For Project and Product Managers
- Increased visibility into the status of key projects: integrating Bitbucket and Jira provides project managers with a centralized view of the status of each project, allowing them to make more informed decisions and track progress more effectively.
- More accurately project lead times and set accurate deadlines: with the integration of Bitbucket and Jira, project managers have access to real-time information on code changes and work item status, which helps them more accurately estimate lead times and set accurate deadlines.
Connect Bitbucket with Jira
We recommend creating a Bitbucket user specifically for the integration. This way, the Bitbucket user can have defined permissions to perform given tasks. Ensure this user has access to the repositories you wish to integrate with Jira.
To continue your Bitbucket Jira integration, you’ll need to install Git Integration for Jira from the Atlassian marketplace. Like all Atlassian marketplace apps, you’ll need a Jira administrator to install the app. Once you have Git Integration for Jira installed, you can begin connecting your Bitbucket repositories with the associated Jira projects.
- From the top navigation bar in Jira, select Apps and then Git Integration: Manage integrations
- Select Add Integration button on the top right
- From the Select Git hosting service page, select Bitbucket.org for cloud
- Select Bitbucket OAuth integration type and click Connect Bitbucket
- You can connect all repositories or select individual repositories by expanding the workspace
At this point, the app will index your repositories and make them available to be viewed in Jira.
Linking Bitbucket with Jira Issues
To create a link between a Git commit and a Jira issue, developers must include the Jira issue key in their commit message.
Example Git commit message: GIT-4322 – Updated the plugin
…
In the example above, GIT-4322
is the Jira issue key linking the commit message to the Jira issue. Commits that are part of non-main branches will be included only if the main branch doesn’t have them.
Pro Tip: When working with a sub-task, put the parent and sub-task Jira issue keys in the commit message so that the commit shows in both places. This way, the commit for the sub-task does not get lost in the many commits of the parent issue.
Create Bitbucket Branch in Jira
On your Jira Cloud instance, open a Jira issue. On the Jira Git integration development panel, click Open Git integration then click Create branch. This will open a dialog box where the branch can be created.
- Select a Repository from the list.
- The git host service logo is displayed for all the repositories in the dropdown list to easily identify which Git service they belong to
- If there are several repositories with the same name, the listed Bitbucket repositories will have their names attached with the owner name. For example,
johnsmith/second-webhook-test-repo
- Use the search box in the dropdown list to filter displayed repositories
- *Optional- Designate the repository to be the default selected repository for current Jira project
- Choose a Source branch.
- *Optional- Designate the branch to be the default selected branch for the currently selected repository.
- Enter a Branch name or leave it as is (recommended).
- Click Create branch to complete this process.
The newly-created branch is now associated with that Jira issue listed in the development panel under Branches. Perform a commit to the newly-created branch to be ready for merge.
Create Bitbucket Pull Request in Jira
To create a pull request from a Jira issue, open the desired Jira issue, click Open Git integration then click Create pull request. This will open a dialog box where the merge request can be made.
- Select a Repository from the list.
- The Git host service logo is displayed for all the repositories in the dropdown list to easily identify which Git service they belong to
- If there are several repositories with the same name, the listed Bitbucket repositories will have their names attached with a Bitbucket group name. For example,
BigBrassBand/second-webhook-test-repo
- Use the search box in the dropdown list to filter displayed repositories
- *Optional- Designate the repository to be the default selected repository for current Jira project.
- Choose the newly-created branch as the Source branch.
- *Optional- Designate the branch to be the default selected branch for the currently selected repository
- Set main as the Target branch
- Enter a descriptive title or leave it as is (recommended)
- Click
Create pull request
to complete this process. Follow the link to the PR to setup for review and approval
Pull requests are still indexed based on branch name even if the PR title does not have the Jira issue key – as long as the branch name contains the Jira issue key. Preview allows you to see the comparison view of the current changes in the selected Source branch vs Target branch (usually main).
Jira Bitbucket Webhooks
By default, repositories are reindexed on a fixed interval. If you want Jira to reflect Bitbucket updates in real time, you must set up Webhooks. To add webhooks to your connected Bitbucket repositories, complete the following steps.
- In Jira, select Apps from the top navigation bar and then Indexing triggers.
- Select Enable Indexing triggers
- Go to Manage integrations on the left panel
- Select the Bitbucket integration you wish to add webhooks to
- On the left, select Feature Settings
- Copy the URL under Indexing triggers
Next, we’ll need to go to Bitbucket to finish the integration.
- In Bitbucket, from your project select Settings and then Webhooks
- Paste in the URL you copied previously
- Under Trigger, select Push events, Pull request events, and Enable SSL verification
- Select Add webhook
Your webhook is now created. Commits, branches, and merge requests that are associated with a Jira issue will now be visible in Jira issues in real-time.
Integrate Jira and Bitbucket Today
Integrating Jira and Bitbucket allows developers to get more done in less time. Developers can quickly access the data they need to complete their tasks efficiently, by having all development information in one system.
With all that time you’re saving the question really becomes, what are you going to do with those extra hours? Here are some of our suggestions:
- Dedicate yourself to finally beating your friend at Super Smash Bros
- Learn another Javascript framework
- Work on that personal project
- Check r/ProgrammerHumor
Regardless of how you choose to fill that newfound time, we wish you the best of luck and happy coding. Want to integrate Jira with your other repo hosting services? Take a look at these related step-by-step guides: