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

Automatically delete branch after merging a pull request

Nick Griffiths
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!
October 4, 2016

When I click "Merge" in a pull request, a dialog gives me the option to delete the source branch: 

image2016-10-4 17:28:43.png

I realise this is "sticky" – Bitbucket will remember what I ticked last time. However, it's easy to untick the box and then forget to tick it again and, before you know it, there are dozens of old branches cluttering the project. Is there any way to:

  • Enable this checkbox for everyone by default – no longer make it "sticky"?
  • Delete all branches for which the associated pull request is merged, and is 0 commits ahead of master branch?
  • Solve my problem another way?

Thanks.

5 answers

6 votes
Mark Hirota
Contributor
February 23, 2017

I'd also like to know if there is something that could be done to set a default for this checkbox: either checked (my preference) or not (for the branch hoarders), and set for either a "project" (my preference) or per repo (in case some folks really really don't like it – "fine, go work in your repo over there" wink)

1 vote
TJOlsenater2
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!
November 12, 2019

Any updates here? I'm looking for the same thing.

0 votes
Chris Hemp
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!
January 29, 2020

At this time, I have found that <https://github.com/nvie/git-toolbelt#git-cleanup> has been useful for team members to run periodically to address this.  And it is conservative enough with what it identifies for deletion with `git-cleanup -n` dry runs.

Would love an organization wide default still.

0 votes
JBWeakley December 7, 2017

The ability to turn this off and on in the settings would be helpful. We use Vincent Driessen's git branching model, and I do NOT need my dev branch to be deleted when I merge it into stage, or stage into prod.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events