Home > Enterprise >  Visual Studio Git Remote list still shows deleted branches
Visual Studio Git Remote list still shows deleted branches

Time:07-01

Is the some button I can hit to make Visual Studio understand that a delete remote branch is no longer there?

The scenario is this: I have an Azure DevOps git branch that I have pushed to the main server and worked on from several different machines. Eventually, (after merging to master) I delete it, both locally remotely using the Visual Studio interface in the dropdown window.

Just to be sure the remote delete worked, I go to the Asure web interface for repos and check. The branch is clearly gone; My delete has worked.

But when I then go to a different machine where I once worked on the branch and look at my list of remote branches, the deleted branch still shows up. Even if I do a fetch and look again it is still there. Even if I delete my local copy. It seems Visual studio doesn't get the memo that the remote branch is gone.

So in order to clean up my list of remote branches on the second machine, I must either delete it remotely... again. Or I can make a clean cone of the repo, then it's gone too.

Is there some other button/menu command I can issue to fix this?

CodePudding user response:

Even if I delete my local copy. It seems Visual studio doesn't get the memo that the remote branch is gone.

Just to be clear, what you're talking about here is not VS, but git. And git intentionally doesn't lose remote branch tips when you fetch, the action you want is called "prune".

To access pruning from VS, use this setting:

enter image description here

  • Related