Working with branch divergence

Still need help?

The Atlassian Community is here for you.

Ask the community

Branches are commonly used in version control systems to develop features or bug fixes without affecting your main branch (also known as the master branch or master for short). This is handy since using a single master branch with multiple people committing their changes at once can create clutter. Branching your code out from master creates a safe space that can contain separate feature configurations, where you can safely commit changes and test Bamboo Specs locally without having to worry about the master branch.

However, if you ran your build plan in an older Bamboo release, the configuration in master would be carried over to your branch, and any additional or custom configuration would be ignored. Currently, Bamboo supports divergent branches; that is, branches containing custom Bamboo Specs build plans and feature branch configurations that are different from those on the master branch.

Bamboo supports divergent branches in repositories stored in Bitbucket Data Center and Bitbucket Cloud.

Prerequisites for allowing branch divergence in Bamboo

Before you can use divergent branches, ensure the following:

  • Your code is stored in Bitbucket Data Center or Bitbucket Cloud

  • Bamboo is integrated with Bitbucket Data Center or Bitbucket Cloud

  • Your project is configured as a linked repository or a project repository

  • Bamboo Specs are stored in the bamboo-specs folder in the same repository

  • Plan branch detection is enabled (it’s on by default)

How to use divergent branches?

I already have plans managed by Bamboo Specs stored in a repository...

That’s great! Make sure that you are using Bitbucket Data Center repository type as other types are not supported yet for divergent branches.

To start using divergent branches just change your specs in the bamboo-specs directory on your branch (it can be either Java or YAML specs) and push your changes!

I manage plans through Bamboo UI...

Consider storing your build plan configuration as code for easier automation, change tracking, validation, and much more. This is the way to best way to create your configuration of divergent branches. We called this feature Bamboo Specs and you can read more about it here.

Know the limitations and changes to the previous behavior of Bamboo

  • Branch divergence is not available for deployment projects. Bamboo ignores any Bamboo Specs on deployment projects in divergent branches.

  • The Other tab is not available in the plan configuration screen for divergent branches. 

  • When using divergent branches, you can’t link any repositories additional to those on master branch. You can change the configuration of that repository but you can’t add or remove it.

  • To create a new plan on your divergent branch, you must first create it on master.

  • Default settings from Automatic branch detection configuration, like triggers and notification settings, are ignored by divergent branches.

  • The default repository of a divergent branch is inherited from the master branch and it’s not possible to select a different repository on your divergent branch.

Last modified on Mar 15, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.