Accept Pull Requests and Auto-Close Branches

By on May 14, 2012

Does your team use branch-based development to work with one repo? Do your pull requests look like this?

Bitbucket has developed a feature that will help you maintain repo cleanliness without the tedious task of closing each branch from the command line.

Now when a pull request is sent across branches, a checkbox will appear giving you the option to close the source branch once the pull request gets accepted. Bitbucket will automatically close the source branch for you, tidying up your team’s repository.

Closing branches after pull requests (until now) has been a manual process that usually never gets done. Save your team time, automate the process, and keep your code organized with the simple click of a box.

Learn more about pull requests and start using this feature today.


  • Gary Reynolds
    Posted May 14, 2012 at 6:52 am | Permalink

    Awesome, this is a great inclusion.

  • Karolis Narkevicius
    Posted May 14, 2012 at 8:19 am | Permalink

    So what exactly does “closing a branch” mean?

    • Nicolas Venegas
      Posted May 14, 2012 at 6:52 pm | Permalink

      For git, it will delete the branch (

      git branch -d


      For mercurial, it will mark the branch as closed (

      hg commit --close-branch


  • Guest
    Posted June 23, 2012 at 2:27 pm | Permalink
  • guest
    Posted July 3, 2012 at 8:26 am | Permalink

     Is it true this option doesn’t show up when the destination branch is inside another repository? When I use the same destination, I can see the checkbox, when I use another repo, say a forked one, the checkbox disappears.

  • Lidstromso
    Posted July 27, 2012 at 6:17 pm | Permalink

    Prodigal play
    gold, such as dung, Hing family but unfortunately fecal such as gold.

    Burst drink
    gluttoney easy to get sick, regular quantitative security Corning.

    Behind is not to
    discuss face to face without advocates.

    Louboutin UK

    Louboutin Sale

    Louboutin Sale UK


    • Ian Hunter
      Posted August 24, 2012 at 5:15 pm | Permalink

      Huh. I never thought about it that way.

  • Anonymous
    Posted August 13, 2013 at 7:07 am | Permalink

    This would be much more useful if Bitbucket were to tag the branch before deleting it, so we could find it later.
    git tag archive/{branchname} {branchname}

  • Anonymous
    Posted April 14, 2015 at 4:16 am | Permalink

    Is there a way to change the default commit message when using bitbucket for closing a mercurial branch ?

  • scott ocamb
    Posted July 31, 2015 at 12:13 pm | Permalink

    What does this do to the code review comments? Are they deleted as well. We may want to keep the code review comments around.