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

Can you create a branch without being about to write to it directly?

Sam Leibowitz
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 11, 2024

We have a repo in Bitbucket that has a branch restriction where developers cannot write directly to branches called *-development.  The intention was to force developers to open a feature/work branch instead, and then open a pull request from there.

Unfortunately, that currently means that nobody can create a branch called *-development, either.

Is there a way to allow users with write access to the repo the ability to create a new branch, but then not have the ability to commit directly to the branch?

2 answers

1 vote
Saxea _Flowie_
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.
September 12, 2024

I'm afraid this is not possible; the restriction prevents both operations. What I've typically seen done is assigning a group with someone like the project lead who can still have write permissions to create the branches. Depending on the workflow, it might be worth automating it. We provide a Bitbucket app to automate PR workflows, which might be useful in your case.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 16, 2024

Hi Sam,

Saxea _Flowie_ is right, this is not possible at the moment. I just wanted to add we have a feature request that you can vote for and where you can add your feedback:

https://jira.atlassian.com/browse/BCLOUD-15220

Kind regards,
Theodora

0 votes
Scarlett Jones September 11, 2024

You should be able to still create a branch, even with a branch rule that you cannot make changes directly to the branch. How did you implement it?

I suggest to use branch permissions and prevent "Changes without a pull request". You may also want to consider preventing "Deletion" and "Rewriting history" along with this.

Scarlett Jones September 11, 2024

Keep in mind though I am thinking of Bitbucket data center. I don't know if this is different in cloud.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events