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 configremote.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.
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.
This is because "git pull" does not remove remote tracking branches for branches deleted from remote repo.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With