Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to enforce branch naming policy ?

Panagiotis Parthenis March 30, 2022

Hello Community, 

 

I am a Panagiotis, and software engineer who likes to improve his skill and try new things. 

 

I am a newbie at bitbucket and I would like some guides and support from the community.

 

My case is simple I would like to enforce a branch naming policy for my Repository. In more detail, my goal is to have only the branch following names and avoid (reject) all other branches which not follow my convention. The branches should follow the convention:  

  • feature-xxxx
  • bug-xxxx-xxxx
  • legacy-fix-xxxx
  • performance-fix-xxxx
  • technical-depth-fix-xxx

 

So If an unexpired use tries to push the branch without the previous pattern matching the push branch should be rejected

 

For simplicity let's assume we should follow only the convention  `feature-xxxx`. My first thought was to set a pattern for the branch permission session, so I try to set the following patter 

* | !(feature-*)  

 

With Write access NONE and Merge via pull request NONE too. But it didn't work. :|

 

Then I try to have separate the rules 

 Rule1

pattern  *

Write access none

Merge via pull request none

 

 Rule2

pattern  ^feature-*

Write access anybody

Merge via pull request anybody

 

But it didn't work that too :(

 

I really appreciate some advice. Thank you all for your time and Collaboration !!

 

Best Regards, 

Panagiotis Parthenis

1 answer

0 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 7, 2022

Hey Panagiotis,

Welcome to the Bitbucket Cloud community!

I am reaching out as I have noticed that you have not yet received a reply from our community. The branch permissions feature is only used to determine READ/WRITE privileges for certain branches and does not restrict users from being able to push new branches that do not match naming conventions.

I have reached out to our development team to create a feature request on your behalf however to potentially include this functionality in Bitbucket Cloud:
https://jira.atlassian.com/browse/BCLOUD-21943

Feel free to "Watch" this feature request for further updates.

Cheers!

- Ben (Bitbucket Cloud Support)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events