Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove deleted Git branches from Visual Studio 2015

Tags:

Visual Studio continues to show any branch I've pulled, even after that branch has been deleted (and I do not have it as the selected branch).

  • "git fetch --all --prune" does not remove them. git config
  • "remote.origin.prune true" (suggested here) does not remove them.

How can I remove the deleted branches from my system?

Update: I want an approach that determines what branches are gone and deletes them. If we select them specifically then sooner or later someone will delete a branch in use by mistake.

like image 787
David Thielen Avatar asked Aug 27 '17 18:08

David Thielen


People also ask

How do I delete a deleted branch?

Deleting a branch LOCALLY Delete a branch with git branch -d <branch> . The -d option will delete the branch only if it has already been pushed and merged with the remote branch. Use -D instead if you want to force the branch to be deleted, even if it hasn't been pushed or merged yet.

Does git pull remove deleted branches?

This is because "git pull" does not remove remote tracking branches for branches deleted from remote repo.

How do I delete a branch code in Visual Studio?

Visual Studio 2017 provides you easy access to both. To delete a local branch, right click on it and select Delete from the context menu. To delete a remote branch listed under the remotes/origin, right click on the desired branch and select Delete Branch From Remote from the context menu that pops up on the screen.


1 Answers

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.

like image 98
Homer Avatar answered Sep 21 '22 13:09

Homer