How to resolve merge conflicts on cascading merges between protected branches?

In our workflow, we protect our release branches to only accept commits via pull requests. This is creating a problem is we have a merge conflict with an automatic cascading merge. The merge conflict pull request gets created, but we're not sure what the proper workflow is to resolve these merge conflicts. 

So far, we've been cutting a new feature branch from master, merging the original feature branch into the new feature branch, merging the target branch for the cascading merge that's failing into the feature branch, resolving the conflicts, and submitting a new pull request to the target branch that the cascading merge is failing on. 

This works, but seems awfully convoluted. Is there a better way? Also, the instructions on resolving merge conflicts in Bitbucket are completely wrong if a target branch is a protected branch (you cannot commit to it directly), causing a ton of confusion. 

1 answer

Let's say I have a restricted release and master branches, requiring two PR approvals before a branch can be merged into these targets. I have made a change in a feature branch, approved the PR and merged the feature into release branch "release/1.3". The subsequent cascading merge to "release/1.4" fails due to a conflict. We solved this with the following strategy:

  1. Create an unrestricted branch from the tip of the target branch
    1. create a new branch "mergefix" from "release/1.4"
  2. Merge the source branch into the unrestricted branch and resolve the conflict
    1. merge "release/1.3" into "mergefix"
  3. Create a new PR from the unrestricted branch to the target branch
    1. create a new PR from "mergefix" to "release/1.4"

 

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,773 views 1 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you