It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

remote branches are not removed from the list after being deleted

I have few remote repositories configured for my project, whenever a new branch created it shows up under the remore repository, but when they are deleted later on, they are not removed from the list and there is no way to remove them unless I remove the remote repository and add it again

6 answers

1 accepted

65 votes
Answer accepted

This is because git always keeps a local record of the remote branch.

To remove these local records, use the Fetch toolbar button and check the 'Prune' option.

That didn't do it. The branches are still there in the sidebar in the "remotes" section under my origin :( This list clutters very fast (though these branches are not present in bitbucket web list of branches)

You can remove those branch labels that no longer exist on your remote by expanding your Remotes in the sidebar and right-click the branch name and choose delete.

I am having the same issue. I selected "Fetch" then "Fetch from all remotes" and "Prune tracking branches...". Reloaded SourceTree and they were still there. I then tried to right click and "Force Delete" them but I get an error saying they no longer exist... I tried restarting SourceTree after that too and no luck :(

Like Autumrose Stubbs likes this

Same here as @Crystal O'Mara, it never removes them after sync and prune. If you're using feature branches, then tens/hundreds of branches fill the list and it is unusable!

If anyone is still having issues with dangling remote branches following a fetch and prune, try deleting your project and then cloning it down again. Sourcetree then correctly located my branches in a different sub-folder (which was capitalized) and succeeded in deleting them permanently.

Like jvolker likes this

That did not work for me.

Like Ravi Pandey likes this

What can be the reason when local branch is not pruned after fetching?

Local branches are never removed by 'git fetch --prune'. Fetch only affects remote branches (i.e. your local record of what the remote branches are).

Like Will Cobbett likes this

I solved this by deleting the "origin" folder in .git/refs/remotes/

Thanks. It works. 

In windows 10. it seems to come back like a birthday candle.  I deleted c:\users\xx\Projects\yyyy\.git\refs\remotes\origin and c:\users\xx\Projects\yyyy\.git\rogs\refs\remotes\origin  .  Then sourcetree managed to conjure up the old branches from somewhere.  they dont show in Bitbucket web UI.

Remove deleted branches always seem to stick around no matter what in Windows even if running `git fetch -p origin` removes them.  However this powershell command has always worked for me to remove all merged branches:


git branch --merged | ? {$_[0] -ne '*'} | % {$_.trim()} | % {git branch -d $_}


It's a lot easier than manually deleting them in sourcetree all the time!

Thanks for explanation!

You need to delete the local branches manually. when you run "git fetch -- prune" . the list of deleted remote branches will appear.


Then you need to manually delete all local branches with the same names by right clicking and selecting delete on all such branches.

keep doing it twice a week and it will not be difficult.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Training & Certification

Atlassian University Live: Conquering Jira Permissions

Atlassian University Live webinars provide you and your teams with the chance to strengthen your Atlassian product skills, and learn directly from Atlassian experts. Our next webinar is titled Conq...

201 views 4 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you