How do I refresh branches (local/remote) in Visual Studio when using Git?

If the branch has been deleted on the server side, try in command line (since such a “button” doesn’t seem to exist directly in Visual Studio):

git remote prune origin --dry-run

(remove the --dry-run option to actually delete the local branches)

Delete the corresponding local branch as well git branch -d aBranch.

Then restart your Visual Studio, and check it picks up the updated branch list. (comments mention you don’t have to restart/refresh VS)

Note: I mentioned before in 2013 the configuration

git config remote.origin.prune true

That would automate that process, and seems to be supported by Visual Studio, as mentioned below by yaniv.


On VSCode, try also to activate the setting “Git: Prune on Fetch”

"git.pruneOnFetch": true

Leave a Comment