How to prevent merging of one branch to another

Is there a way to prevent merging of one branch to another. We have branches like 15-maint 16-maint master, we merge forward from 15-maint to 16-maint and also from 16-maint to master but never from 16-maint to 15-maint or from master to 16-maint. Sometimes due to human error, of the person merging, higher branch is merged to lower - like 16-maint to 15-maint or master to 16-maint. Is there any way to prevent this by means of hooks or configs in Bitbucket ?

1 answer

This widget could not be displayed.

Hi Bopanna

You can use branch level permissions and a branch naming convention to limit who has the capability to merge. Take a look at the documentation available at https://confluence.atlassian.com/display/BitbucketServer/Using+branch+permissions

Cheers

Bhushan

@Bhushan Nagaraj : Thankyou for the documentation link. But It does not provide the option to achieve what I am asking...

@b bopanna would you please elaborate why branch permissions won't work for you? 

@Ulrich Kuhnhardt [Izymes]: There are 4 restrictions available :

i. Prevent all changes

ii. Prevent deletion

iii. Prevent rewriting history

iv. Prevent changes without a pull request

Now how can I use these to configure my lower branches to not allow merges from higher ? (do not permit merge of master to 16-maint while allowing merging of 15-maint to 16-maint ?)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

1,328 views 8 11
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