Someone please explain "Branch merging" and whether I should be using it
Asked by Jonas Gucu:

Hello,

We are currently migrating to a new Bamboo version and I'm remaking our pipelines.

One thing I noticed is, on every pipeline, Branch Merging is enabled with the "*Branch Updater"* option.

Everything is fine with it, I think.

A couple of builds for projects with development and master branches are failing. For some reason when building development branch on new Bamboo, it tries to merge itself with master branch and it fails due to conflicts. I don't understand why this is happening?

P.S. I noticed that the same projects have Branch Merging disabled for development branch in old Bamboo. I'm guessing someone ran into the same problem as I am currently.

What to do?

Thank you.

Update: I found a post on SO that says "The "Branch Updater" feature is to merge the code from master branch into feature branch **after a successful build of the master branch** .".

Is this only valid for branches that start with "feature/"?


Answers:
author: Ayrijit Swain
body: Hello Jonas,

Welcome to Atlassian community.

When**Branch merging** is enabled with**Branch Updater** option, current branch(feature branch) is checked out followed by merge from the master branch. Upon successful merge, build is run against the plan branch.

Optionally on successful build, bamboo can push the changes to the to the current branch in the source repository.

You can refer to the pictorial representation of what happens in the background.

![image.png](https://trello.com/1/cards/655df4914058c30c01969430/attachments/658672886cab613e11b6923c/download/image.png)

With regards to your query,
> Is this only valid for branches that start with "feature/"?

Branch merging can be configured for all the plan branches in Bamboo and not necessarily with branches that start with "feature/"

Regards,

Ayrijit Swain

**\*\*please don't forget to Accept the answer if your query was answered\*\***

comments: author: Jonas Gucu
body: Hello,

Image is not showing.

Can you explain why this happens?

![dev master fail.png](https://community.atlassian.com/t5/image/serverpage/image-id/314745iCD05DE2CB101F7EF/image-size/large?v=v2&px=999 "dev master fail.png")

And this is only happens for a few projects.

Why is it trying to merge dev with master when building development branch?


author: Ayrijit Swain
body: Hello Jona,

I am sorry that the image is not loading for you. You may refer to the documentation which has more details regarding the Branch update merging statergy in Bamboo [https://confluence.atlassian.com/display/bamboo/using+plan+branches#:\~:text=Under%20Merging%20select%20Branch%20merging,Select%20Save](https://confluence.atlassian.com/display/bamboo/using+plan+branches#:~:text=Under%20Merging%20select%20Branch%20merging,Select%20Save).

With regards to your query below,
> Why is it trying to merge dev with master when building development branch?

For **Branch updater** merge, it merges the master with the feature branch. If you are saying its the other way around, please check if **Gatekeeper** branch merging is enabled for the plan. You can find more details on how Gatekeeper works in the same article posted above.

For any build failure that happens due to merge conflict, needs to be resolved by the developer outside in the source code repository.

Regards,

Ayrijit Swain


author: Jonas Gucu
body: Okay, but it's normal that development and master branches are different and there will be conflicts.

So should I just disable branch merging for development branch?


author: Ayrijit Swain
body: HI Jonas,

If the conflicts are very common for your development branch, you may disable the branch merging for the build to pass.

However, this feature is helpful to detect conflicts for each change and resolve it when build failures are detected which will be much easier for the development team as compared to resolving conflicts for multiple changes at once.

You may discuss this with your development team and decide if disabling branch merging would be a better option for the team.

Regards,

Ayrijit Swain

**\*\*please don't forget to Accept the answer if your query was answered\*\***


author: Jonas Gucu
body: Thanks.


Tags: branch

merge

merging

updater