<p>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 <a href="https://bitbucket.org/site/master/issues" rel="noreferrer">https://bitbucket.org/site/master/issues</a>.</p>

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

CC BY-SA 3.0
2017-12-03T15:01:38.073Z
https://bitbucket.org/site/master/issues/15300
030
CC BY-SA 3.0
2017-12-01T02:05:44.750Z
2017-12-01T02:05:44.750Z
Bryan Turner
<p>For Bitbucket Server you can set this up on a project or repo-level under Settings &gt; Branches (under the Workflow section), scroll to the bottom and tick this setting on and press save:</p>
<p><a href="https://i.sstatic.net/PqhKj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/PqhKj.png" alt="branch-deletion-on-merge-setting" /></a></p>
<p>So all in all you have two options:</p>
<ol>
<li>Change this setting on a project-level and have all repos under it inherit the project's settings by default</li>
<li>Change this setting on a repo-level (if you want only some of your repos to adhere to this)</li>
</ol>

CC BY-SA 4.0
2023-01-31T19:37:52.890Z
For Bitbucket Cloud, I developed this [Open-Source extension](https://github.com/hmartos/bitbucket-pull-request-auto-delete-branch), which you can install from the [Chrome Web Store](https://chrome.google.com/webstore/detail/bitbucket-pull-request-au/iffllgmebelmfdfiiagjgbpjhplobfem)
hmartos
CC BY-SA 4.0
2021-12-01T13:46:16.190Z
2021-12-02T08:40:35.987Z
2021-12-02T08:40:35.987Z
jlo
<p>Apparently selecting the <code>Close branch</code> option in the very dialogue illustrated in your question will actually delete the branch as well. From 
<a href="https://community.atlassian.com/t5/Bitbucket-questions/Why-only-quot-Close-quot-a-branch-instead-of-quot-Delete-quot-it/qaq-p/417416" rel="nofollow noreferrer">Why only "Close" a branch instead of "Delete" it?</a>:</p>

<blockquote>
  <p>Ben Tatham Jun 15, 2014</p>
  
  <p>It seems that I was mistaken. Marking a pull request to <em>Close branch
  when merged</em>, does indeed Delete it. I'm not sure why they use
  different language for that though.</p>
</blockquote>

CC BY-SA 3.0
2017-11-24T19:54:11.653Z
Could it be selected by default? I would like to avoid that people have to select it because I see that they forget to click it.
030
CC BY-SA 3.0
2017-11-24T20:01:57.983Z
Ah, I see what you mean. AFAIK there isn't such options. Maybe it's worthy filing a feature request for it? See [New features policy](https://confluence.atlassian.com/bitbucketserver/new-features-policy-776640886.html)
Dan Cornilescu
CC BY-SA 3.0
2017-11-24T20:31:03.277Z
https://jira.atlassian.com/browse/BSERV-10344 created
030
CC BY-SA 4.0
2018-07-17T13:28:22.983Z
It was moved to https://bitbucket.org/site/master/issues/15300
Shereef Marzouk
CC BY-SA 3.0
2017-11-24T19:52:23.303Z
2017-11-24T19:52:23.303Z
Dan Cornilescu
<p>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?</p>

<p><a href="https://i.sstatic.net/BGwNl.png" rel="noreferrer"><img src="https://i.sstatic.net/BGwNl.png" alt="enter image description here"></a></p>

<p>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?</p>

CC BY-SA 4.0
2018-07-17T13:28:01.427Z
https://bitbucket.org/site/master/issues/15300  Please vote for this issue
Shereef Marzouk
<bitbucket>
How to close a branch by default after a pull request has been merged in Bitbucket?
030
# How to close a branch by default after a pull request has been merged in Bitbucket?

(Asked by: username_0 on 2017-11-24)

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](https://i.sstatic.net/BGwNl.png)](https://i.sstatic.net/BGwNl.png)

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?

**Tags:** bitbucket

> **Comments:**
> **username_1**: https://bitbucket.org/site/master/issues/15300  Please vote for this issue  

---

## 3 answers

### Answer by username_5 on 2017-11-24. Score: 4 | Accepted answer

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?](https://community.atlassian.com/t5/Bitbucket-questions/Why-only-quot-Close-quot-a-branch-instead-of-quot-Delete-quot-it/qaq-p/417416):

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

> **Comments:**
> **username_0**: Could it be selected by default? I would like to avoid that people have to select it because I see that they forget to click it.  
> **username_5**: Ah, I see what you mean. AFAIK there isn't such options. Maybe it's worthy filing a feature request for it? See [New features policy](https://confluence.atlassian.com/bitbucketserver/new-features-policy-776640886.html)  
> **username_0**: https://jira.atlassian.com/browse/BSERV-10344 created  
> **username_1**: It was moved to https://bitbucket.org/site/master/issues/15300  

---

### Answer by username_2 on 2017-12-01. Score: 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.

> **Comments:**
> **username_0**: https://bitbucket.org/site/master/issues/15300  

---

### Answer by username_3 on 2021-12-01. Score: 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](https://i.sstatic.net/PqhKj.png)](https://i.sstatic.net/PqhKj.png)

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)

> **Comments:**
> **username_4**: For Bitbucket Cloud, I developed this [Open-Source extension](https://github.com/username_4/bitbucket-pull-request-auto-delete-branch), which you can install from the [Chrome Web Store](https://chrome.google.com/webstore/detail/bitbucket-pull-request-au/iffllgmebelmfdfiiagjgbpjhplobfem)  

---

