How do I remove deleted Git branches from Visual Studio 2015

I had remote branches that would not go away even after they were deleted on the server. This tip about setting "Prune remote branches" worked for me. I found it here.

Go to Team Explorer, and click Home button. Then Settings > Repository Settings, and set "Prune remote branches during fetch" drop-down to True. Don't forget to click "Update" button to save your edit.

After changing the setting I did a fetch on one of the deleted branches and all of the deleted branches disappeared.


In the newer version of visual studio 2019 for example 16.8.6 you need to go to settings and find git settings as shown below:

enter image description here


prune is about removing any remote-tracking references that no longer exist on the remote.

So if the branch still exists on the remote side, it won't be deleted locally.

If the branch is deleted locally (with Visual Studio), its remote tracking instance will still be re-created at the next push.

You need to make sure the branch is also deleted on the remote side:

git push origin --delete abranch