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 vote
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 vote

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 Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

23,297 views 26 12
Join discussion

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