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

    Awesome, this is a great inclusion.

  • Karolis Narkevicius

    So what exactly does “closing a branch” mean?

    • Nicolas Venegas

      For git, it will delete the branch (

      git branch -d


      For mercurial, it will mark the branch as closed (

      hg commit --close-branch


  • Guest
  • guest

     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

    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

      Huh. I never thought about it that way.

  • Anonymous

    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

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

  • scott ocamb

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