11

By default a branch will remain in Bitbucket when a Pull Request (PR) has been merged. How to ensure that a branch will be removed after a PR has been removed?

enter image description here

When the option is enabled then the branch will be removed after the merge of a PR, but how to ensure that it is clicked by default to prevent that creators of the PR forget to click it and the branch remains in bitbucket?

1

3 Answers 3

4

Apparently selecting the Close branch option in the very dialogue illustrated in your question will actually delete the branch as well. From Why only "Close" a branch instead of "Delete" it?:

Ben Tatham Jun 15, 2014

It seems that I was mistaken. Marking a pull request to Close branch when merged, does indeed Delete it. I'm not sure why they use different language for that though.

4
6

What I really want is to add a comment to the accepted answer, but I don't have enough reputation to do so. So I'll note it here. I've closed BSERV-10344 because it's in the wrong tracker. This question is about Bitbucket Cloud (bitbucket.org), not Bitbucket Server (the behind-the-firewall version). The correct issue tracker for the feature request is at https://bitbucket.org/site/master/issues.

Also, re: "I'm not sure why they use different language for that", it's because Bitbucket Cloud supports Mercurial as well as Git. In Mercurial it's not possible to delete a named branch; they can only be closed. Since its support for Mercurial predates its support for Git, the terminology used is to "close" the branch.

1
4

For Bitbucket Server you can set this up on a project or repo-level under Settings > Branches (under the Workflow section), scroll to the bottom and tick this setting on and press save:

branch-deletion-on-merge-setting

So all in all you have two options:

  1. Change this setting on a project-level and have all repos under it inherit the project's settings by default
  2. Change this setting on a repo-level (if you want only some of your repos to adhere to this)
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.