1. Bitbucket Website
  2. Public Issue Tracker
  3. master

Issues

Issue #8342 on hold

Deleted branch still listed (BB-9455)

Abhaya Thapa
created an issue
  1. Delete branch branch-name.
  2. https://bitbucket.org/project-name/branches 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 https://bitbucket.org/agrian/asm/branches as branch no longer exists

Comments (48)

  1. reynardmh

    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. 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

  7. Dan Bennett staff

    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.

  8. Dan Bennett staff

    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.

  9. Dan Bennett staff

    Update:

    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.

  10. 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.

  11. 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.
  12. Dan Bennett staff

    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.

  13. Seb-N0406802

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

    Error
    Failed to delete <branchname>
    

    So much for the repo housekeeping today

  14. Lakshminarayanan Krishnan

    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>
    
  15. 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

  16. 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 Lakshminarayanan Krishnan and creating the branch again to be able to delete it, but it's annoying.

  17. Dan Bennett staff

    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.

    Thanks,

    Dan

  18. Dan Bennett staff

    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.

  19. 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).

  20. 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?

  21. Nate Cook

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

  22. 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.

  23. Log in to comment