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

Khaled Ayoubi Aug 23, 2012

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

56 votes
Answer accepted
Steve Streeting Aug 24, 2012

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)

Jae Yoon Jun 16, 2017

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.

Crystal O'Mara Sep 27, 2017

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
Sebastian Wolf Nov 30, 2017

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!

Michael Hanslo Mar 26, 2018

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.

Eric Apr 26, 2019

That did not work for me.

1 vote
Cyprian Kowalczyk Jul 05, 2013

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

Steve Streeting Jul 07, 2013

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
1 vote
Florian Meyer Nov 04, 2018

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

Irina Shanina Jan 23, 2019

Thanks. It works. 

Chip Broecker I'm New Here Apr 26, 2019

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.

0 votes
Cyprian Kowalczyk Jul 07, 2013

Thanks for explanation!

0 votes
Aman Bains May 26, 2019 • edited

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.

0 votes
Chris Chan Jun 07, 2019

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!

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Off-topic

What podcasts are you listening to right now?

Like the title says: what podcasts are in your rotation right now? Here are some favorites I've been in to from the last few weeks. The Ringer NBA Show I've been diving deep into the NBA Playoffs...

820 views 16 9
Join discussion

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