Many times while completing a pull request we delete the source branch, this deletes the branch from the git server, but still, the reference to that branch would appear in Visual Studio. Even if you do a
sync, the deleted branch from the server would still appear in Visual Studio.
As you can see in the above image, a deleted branch (feature1 branch) still shows up in visual studio.
So to remove, first let's check which branches have to be pruned (remove reference). Run
git remote prune origin --dry-run
--dry-run just mimics the prune and does not actually remove it.
Now to remove the branches, run the prune command without the
git remote prune origin
If you go ahead and check in visual studio, you wouldn't find the pruned branches inside remote.
If you want to remove the local branch as well; right-click on that branch in visual studio and choose delete from the context menu.
Alternatively, you could also run
git branch -d feature1
in a terminal window.
That's it!! You have removed references to your unused local and remote branches!
Did you find this article valuable?
Support Kumar Ashwin Hubert by becoming a sponsor. Any amount is appreciated!