Deleted branch still listed (BB-9455)

Issue #8342 open
Abhaya Thapa created an issue
  1. Delete branch branch-name.
  2. still lists the branch-name.
  3. When clicking on this branch, leads to 404 error as branch is deleted.

The deleted branch should not be listed on as branch no longer exists

Comments (57)

  1. Reynard Hilman

    I don't think so. I have deleted branch from 2 weeks ago that is still appearing. It's very annoying when your workflow is using branches for each developer and pull request for code review. I have a lot of deleted branches that is still listed. This should be a major issue. This ticket has been open for more than 6 months. Please fix this soon!

  2. Brendan Mannix

    I can confirm I am experiencing the same issue. If this is a simple caching issue, why has this not been fixed in 6 months? It seems like it would be fairly straightforward to invalidate the cache whenever a branch is deleted...

  3. Thibault Meyer

    Issue (when using Pull Request with "delete branch" option) still exist since... minimum 2 years!!! If you don't have skill (or time) to fix this, add a button to manually force remove orphan branch or hide branch who leads to 404 error when clicking on.

  4. Alexandre Blondin Massé

    I had the same problem. I deleted a branch with the command

    git push origin :<branch-to-delete>

    The problem was that it still appeared in the list. I solved my problem by creating a new branch from the Bitbucket web interface with exactly the same name, and then I deleted it again from the web interface (under the tab branches, hover on the right part of the branch you wish to delete and click on the three dots and then select delete branch). And then, it was not in my branches list anymore.

    This is not very elegant, but at least, I could clean my repository.

  5. Matthew Baker

    We started experiencing this Friday on several branches and it just happened again today. The issue does not correct itself after time (whenever the "cache" refreshes), despite comments from Atlassian saying as much. Clicking the branch is a dead link like described above, and trying to delete the branch throws an error. Pull requests tied to the branch that were merged are also being odd (e.g., showing a mix of different states like "No files changed" but remaining open, showing a conflict and saying either the source or destination branch is deleted, etc.). The workaround mentioned above about recreating the branch and deleting it does work, but we shouldn't have to resort to this workaround.

    For those interested in tracking continued progress of this bug, I noticed that a duplicate issue #9608 was marked as invalid for some reason. #9688 appears to be another duplicate.

  6. Rhys Bartels-Waller

    Experiencing the same bug over here. And yes the workaround is valid, but it sucks to have to do this

  7. Daniel Bennett Account Deactivated

    Thanks for the workaround detail. That'll give us something to investigate as reproducing this continues to elude us.

  8. Jiří Šimeček

    Also confirming this is still an issue although some other issues regarding same problem were closed and marked as invalid saying it is OK without further investigating (eg #9608) - quite sad.

    As it seems to me the "Bitbucket's purging cron/job" (mentioned by someone from staff) is not fired properly when branch is deleted via Pull Request.

    Eg: Happened to us last week we had circa 6 invalid branches that were still visible and all of them leaded to a dead link. When I created one branch and then deleted it the purging job was fired correctly (my guess) and all branches were properly removed.

    Its quite pain for us to have many branches and half of them are active and half was already merged and deleted - It's not simple to keep track of works in progress then...

    Thanks for looking into it @Dan Bennett, Jiri

  9. Daniel Bennett Account Deactivated

    A couple of different vectors leading to this problem have been identified. We are working on some fixes and improvements and we should be able to close this issue in the next week or two.

  10. rdenhaan

    Same annoying issue. BTW I would not say this is a "minor" issue. It confuses our team and reduces our productivity.

  11. Manjunatha H R

    I am facing the same issue here, It took me 1 hour - before i realised its bug with bitbucket

  12. Daniel Bennett Account Deactivated

    The manifestation has been around for two years -- that is correct, however, the bug is actually a moving target. When we stamp out what appears to be the largest contributor another cause rises to the top of the stack. We are currently developing a brute-force solution as well as continuing to investigate the root causes so it has taken longer than we had hoped. The next change to resolve this situation should land in 2-4 weeks.

  13. Daniel Bennett Account Deactivated


    The latest change to reduce this problem has gone out. This does not mean that we consider this closed so please update here if the issue persists.

  14. Scott Mathson

    I've still got "phantom" branches that should have been deleted along with a merged PR in my list of branches (they were merged Friday afternoon). So if the fix went out before that then it didn't work in my case. Will see if the next PR that I merge deletes the branch properly.

  15. Scott Mathson

    Just had the chance to test merging a PR that should have deleted the branch automatically and it still doesn't work.

  16. Jiří Šimeček

    Hi @Dan Bennett, thanks for keeping us updated! Unfortunately the update seems had no impact on us so far:

    • I've checked one of our projects. Have 6 active branches which 2 of them were merged and leads to dead link.
    • Just merged (few minutes ago) another PR which closed its branch and the branch is still visible in the Branch list and leads to dead link.
  17. Daniel Bennett Account Deactivated

    One thing I forgot to mention earlier... This will not be instantaneous. PR merge operations can take some time for large repositories with many branches and the branch calculation task will run afterward. We've recently extended the maximum time for the calculation job to run from 5 minutes to 10 minutes. That's just the run time for the calculation, not total wait time or anything.

    We have another change pending that will eliminate this for everyone using brute-force removal of deleted branches from the page at display time. I'll provide another update when I have an ETA for its release.

  18. Seb-N0406802

    Also just ran into this issue, trying deleting via web interface which gives me the error

    Failed to delete <branchname>

    So much for the repo housekeeping today

  19. Lakshminarayanan Krishnan Account Deactivated

    We are also experiencing this issue. The only way I've been able to fix this is by executing the following command after the pull-request has been completed/approve-merged:

    git checkout -b <deletedbranchname> <some-other-remote-branch-name>
    git push origin <deletedbranchname>
    git checkout master
    git push origin :<deletedbranchname>
    git branch -D <deletedbranchname>
  20. Samuel Cousin

    After about a week of regular operations in our repo, I have noticed today that the ghost branch had been deleted. Sorry, no information as of what (if anything but time) might have solved this issue in our case. Cheers

  21. Sudhindra Kumar Account Deactivated

    We are also facing this issue of ghost branches dangling around even after deletion!

  22. Justin Derbas

    Same issue here. Branch still shows up after a pull-request was merged with the "Close source branch" option selected.

  23. Michel Sabchuk

    We are facing a similar issue but, in our case, the branch is not listed in the branches section of bitbucket but is still listed as a remote branch using git in command line. I going just like @lnkrishnan and creating the branch again to be able to delete it, but it's annoying.

  24. Daniel Bennett Account Deactivated

    We've made a change to the way we display branches. This issue should be resolved for most, if not all users at this time. Please report back here on any problems encountered.



  25. Daniel Bennett Account Deactivated

    @Michel Sabchuk Bitbucket does not have any control over the branches displayed in a local repository. The behavior you are describing is simply the way git works. You can use git remote prune origin to remove "dead" branch references from a local repository.

  26. Bradley Denby

    This issue seems to be affecting me. I forked a repo, created a feature branch from the develop branch, and made a pull request (my feature branch to original develop branch) to the original repo with the "Close branch after pull request is merged" option checked. After the pull request was merged, the branch still exists in my Bitbucket repo. Unlike some other reports in this thread, I can still access the feature branch (i.e. no dead links).

  27. Nate Cook

    Holy cow, how is this still a bug? Branches merged via pull requests with the "close branch after pull request is merged" checkbox checked are not getting removed. Seriously?

  28. Zachary Davis Account Deactivated

    @mablem8 @Nate Cook That sounds like a completely separate bug, but not one I am able to reproduce. Can you either open a new ticket or contact support with as much information as possible (does it happen all the time, on all of your repos, possibly example repos where you're having trouble)?

  29. Nate Cook

    I can confirm that it happens just sometimes. Will start paying close attention and will contact support with more information. Thank you

  30. Bradley Denby

    I have been using the following work around to delete branches after they have been merged:

    git push origin --delete branch-name

    Because the branches still have to be deleted locally anyway (git branch -d branch-name), running one more command isn't a big deal.

    I haven't been using the "Close branch after pull request is merged" option due to the issue I describe above, so unfortunately I currently have no information about reproducing the bug.

  31. Roman Bolshakov

    I can confirm this bug still exists. I used the same command git push origin :branch-name. Now the branch is deleted but I still have it in the list as dead link

  32. tgp1994

    I'm also facing the issue: I closed a "develop" branch in my repo, now I'm trying to create a new branch with the same name through Bitbucket's UI. Bitbucket says the branch already exists.

  33. Tim Blochwitz

    I found another workaround to fix this issue by using the sourcetree. Just delete the branch in "Branches" and "Remotes" and click on "Push".

  34. Marcos Casagrande

    We're facing the same issue. I deleted 7 times, 100 merged branches, they keep reappearing. I don't mind seeing them in the branch list in bitbucket UI, but when performing a pull the branches are being pulled!

    git pull
     * [new branch]          multiple-times-deleted-branch                                  -> origin/multiple-times-deleted-branch
  35. Log in to comment