How to give logical conditions in branch permission

Hello

I need to restrict master and release/* branches to avoid "deletion, rewrite history, changes without PR" and I've tried this "master|release/*, but didn't work for me. Is it possible for me to combine these two in a single rule? I know I can give separate rules, I'm looking for more optimized solution.

Thanks/Bijoy

2 answers

1 accepted

0 vote

Hi Bijoy, 

you will need to create 2 separate branch permission rules, there is currently no way to do it in a single rule. If I may ask, why are you trying to put both in the same rule?

The pattern matcher in Bitbucket Server does not support the full regex syntax, see the Branch permission patterns page for details.

For the use-case you describe, you can create the following permissions: 

  • "Branch model" for the "release" prefix or "Pattern" with "release/"
  • "Branch" for "master" or "Branch model" development branch (if master is your default branch) or "Pattern" with "refs/heads/master"

Felix

 

Hi Felix

Thanks for the quick response. We used to use regex for other hooks and I've tried the same here also and didn't work.So decided check with Atlassian, that's it. I'm OK I can create multiple rules.

Thanks/Bijoy

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

22,423 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