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
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 must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 :(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That did not work for me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I had this problem too.
I unchecked the prune checkbox in Fetch and clicked ok. Then checked the prune checkbox again and fetched. Origin was then cleared for non-existing branches.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This worked great! I was doing this manually for so long until I got tired of it and found this question and answer. Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I solved this by deleting the "origin" folder in .git/refs/remotes/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks. It works.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You will need to delete the local branches manually (i.e. right click branch and delete). Should there be un-pushed commits locally, you will have to tick 'Force Delete'.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What can be the reason when local branch is not pruned after fetching?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This worked, "git fetch -p origin" cleaned the remote branches in the local projects.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.