Manage unmerged branches

Bitbucket Cloud tracks unmerged branches in the Feature branches view. You can use this view to manage your development process by doing any of the following:

List feature branches

A user must push a branch to the Bitbucket remote repository for it to appear as a feature branch. Feature branches lists only unmerged branches. To list the feature branches, log into Bitbucket do the following:

  1. Navigate to your repository.

  2. Select the Commits context from the navigation bar.

  3. Click Show all.

    The displays includes information about the branch in tags next to the date. In the preceding figure you can see the new-feature branch listed. You can also see that there was another branch fix-issue-1 which was recently merged into the main branch making the new-feature branch one commit behind.

Compare a feature branch to the main line

You can use the Compare function to see differences between code lines. This function allows you to see individual files and the changes within those files.  Try a comparison now:

  1. Navigate to a repository with multiple branches. You can always create a branch in an existing repository so you can get more familiar with comparing branches .

  2. Select the More options () button in the upper-right corner of the repository.

  3. Select Compare tags or branches from the dropdown menu.

  4. Select the branch you want to compare to the main branch.

  5. Press the Compare button on this branch. Change the comparison fields if you like.  

Bitbucket uses git diff ...

A three-dot diff is a comparison between the commit where the feature branch was last synched with the destination branch and the most recent version of the feature branch.

A two-dot diff is the direct comparison of two committish references such as SHAs.

Sync a branch to the mainline

If a feature branch is behind the current branch, you can sync (merge) the branch with the mainline. You sync a branch, for example, to catch your branch up to all the latest changes on the mainline.

  1. Select Branches on the left sidebar.

  2. Select the branch you want to sync.

  3. From the Commits tab, select Sync now in the info banner under the tabs.

  4. In the Sync branch dialog, select the Sync strategy dropdown to choose your preferred merge strategy.

  5. Select Sync.

  6. To view the conflicts, click the Diff tab.

For more information on the merge commit and rebase merge strategies, refer to our Learn git tutorials:

Close or delete a branch

When you close or delete a branch, you lose all the unmerged changes on that branch. The branch also no longer appears under the Source list of Branches. You would close an unmerged branch, if for example, the branch represented some experimental testing that failed for which you no longer needed the work.  To close a branch:

  1. From the left sidebar, click Branches.

  2. Locate the branch you created.

  3. Click the More button in the top right.

  4. Choose Delete branch.
    Bitbucket displays a confirmation dialog. 

  5. Press Confirm.
    Bitbucket closes the branch, and it no longer appears in your remote repository.

Still need help?

The Atlassian Community is here for you.