Lesstep
Bitbucket Cloud · Bitbucket Data Center · REST API · October 27, 2026

Bitbucket did not delete the source branch after merging

Both Bitbucket Cloud and Bitbucket Data Center can delete a pull request's source branch when it is merged, if they are asked to, and each decides at a different moment. When the branch is still there, it is usually one of five things: the option was off when the merge happened, a script merged without asking for it, a branch permission kept it, it is the default branch, or the branch is gone from Bitbucket and only your local Git still lists it.

Bitbucket Cloud: Close source branch

Bitbucket Data Center: Delete source branch after merging

What to check

  1. Is it gone from Bitbucket? Look at the repository's branch list. If it is gone there, your Git only keeps a remote-tracking copy: git fetch --prune removes copies of branches that no longer exist on the server.
  2. Was the option on at merge time? On Cloud, the pull request in the API has close_source_branch; on Data Center the box is in the merge dialog.
  3. A branch permission (Data Center) or branch restriction (Cloud) that does not let you delete the branch can keep it. Delete it as someone who is allowed, or leave it if the rule is meant to keep it.
  4. A script: on Cloud, send close_source_branch with the merge; on Data Center, call branch-utils after the merge succeeded.
  5. To delete it by hand: the branch list on the web, or git push origin --delete feature/login.

Bitbucket pull requests in IntelliJ IDEA

Pull Request Inbox for Bitbucket, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, lists the pull requests that wait for your review in an IDE tool window, from Bitbucket Cloud and, in beta, from Bitbucket Data Center 8.9 or later with a personal HTTP access token, sent only to that server. Its merge dialog has Close {branch} after merging, starting from a setting you choose once. On Cloud it sends close_source_branch with every merge, so the value stored on the pull request does not decide it. On Data Center it merges first and then deletes the branch with branch-utils; when Bitbucket refuses the deletion, it says the pull request was merged and the branch was not deleted, with Bitbucket's reason. The review inbox, diffs and discussions are free; merging, approving and commenting are Pro (US$1.50 a month, with a 30-day trial).

Get it on JetBrains Marketplace

Bitbucket and Atlassian are trademarks of Atlassian; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by Atlassian or JetBrains.

More: Bitbucket merge strategies · pre-receive hook declined · Bitbucket pull request plugins for IntelliJ IDEA, compared · 日本語