Preventing users to merge branches in Bitbucket/Stash

Hello Team,

 

My team consist of a number of developers who requires write access to branches named branch 1 and branch 2. Now sometimes, they mistakenly merges wrong branch to the wrong target. i.e, they are suppose to merge branch 1 to branch 2. What is the way to prevent users from merging branch 2 to branch 1. Or is there a way to make branch 2 a default one?

 

Warm Regards,

-Jewel

3 answers

0 votes
Mikael Sandberg Community Champion Jun 30, 2016

Are you using pull requests when merging between branch 1 and branch 2? You can change the default branch for a repository under settings > repository details. The default branch will be used as the target branch when you create a pull request. But it will not prevent a user from changing the target branch.

0 votes

You can make branch2 default in the repository settings. But there is no way to restrict the merges based on branches.

You can write plugins with hooks to prevent it on the server. But users will still be able to do it locally. The advantage and disadvantage of using git!

We're actually looking to do this very thing. Doing a google search I don't see any plugins that have this capability as well. Something I'm missing? Trying to not write our own plugin here if it's at all possible.

Suggest an answer

Log in or Join to answer
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...

652 views 0 4
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot