Preventing users to merge branches in Bitbucket/Stash

Jewel Francis June 30, 2016

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
Christopher Dancy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 22, 2017

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.

0 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 30, 2016

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!

0 votes
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events