Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Prevent accidental deletion of a branch?


is there a way to prevent an accidental deletion of a branch, e.g. when merging a Pull Request and someone clicks on "Delete source branch on merge"?

It is about Bitbucket Cloud.

Thank you

3 answers

1 accepted

1 vote
Answer accepted

Hi Jaroslav, 

Can you check  Tim's solution ,it will do the following :

  1. Deny deletion of branches.
  2. Deny force pushes to branches.
  3. Deny deletion of tags.
  4. Deny modification of tags.




jredmond Atlassian Team Aug 20, 2018

Unfortunately, Tim's solution is for Bitbucket Server.

For Bitbucket Cloud, however, you can use branch permissions to prevent users from deleting the branch in question.

Hello Tom,

there is a new option under custom settings: "Deleting this branch is not allowed"

I swear two days ago it wasn't there :-)

Thanks a lot!

I'm not seeing an option to prevent deletion of master or a branch "type" (like Development)...

It's very easy in a git GUI or CLI to accidentally select to delete the remote branch or mistype an option.

I'm not sure a plugin is feasible without knowing exactly what it's seeing or doing in its code execution (privacy & security issue), and also an incompatibility or update can cause disruption if we're relying on it.

Hey, just add a user to write permissions and then you will get checkboxes for controlling deletion and rewriting history.

Like guy_carpenter likes this

Just a thought/idea, you may want to solve this problem at a lower layer, in `git` you can use an update-hook and simply prevent the deletion. This should live with the repo and protect it where it sits Bitbucket cloud or server.

jredmond Atlassian Team Sep 09, 2019

Hooks are not included in pushes or pulls, though, and users do not have direct filesystem access to the .git directory in a repo on Bitbucket Cloud.

@jredmondfair enough. I also assumed users could edit repos in Bitbucket Cloud.

There's a bug in Jira! If no user is on the write access field you won't see the options to prevent the branch to be deleted. Add a user, check/uncheck the option, remove the user and save.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Calling any interview participants for Bitbucket Data Center

Hi everyone,  We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...

485 views 5 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you