Deleted origin git branches aren't removed from VS2015 git

Posted on Posted in Uncategorized

We use a git­flow-esque branch­ing strat­e­gy where a new branch is cre­at­ed for each fea­ture being worked on. Once the code is sync'd to the serv­er and the PR is approved, the code is merged down into our main devel­op­ment branch and the fea­ture branch is auto­mat­i­cal­ly delet­ed from ori­gin by Visu­al Stu­dio Team Ser­vices. This results in a lot of branch­es that we work on. One issue that popped up was that despite the branch­es being delet­ed from ori­gin, we'd still see the branch­es with­in Visu­al Stu­dio 2015's git Branch­es pane.
Too many branches

Of all the branch­es list­ed in the remotes/origin/feature fold­er, only 2 of them still exist at ori­gin. Fetch­ing from with­in VS2015 does not remove the entries which are no longer valid. The issue stems from VS2015 not sup­port­ing remote ori­gin prun­ing. An easy workaround is to go to the com­mand prompt and run:

git con­fig remote.origin.prune true

From that point on, any fetch com­mands per­formed by git will also prune any branch­es that are no longer valid from the remote/origin list. Once this option is turned on, we can per­form a Fetch from with­in Visu­al Stu­dio and voila!
Much more concise

We now only see the branch­es that still exist on ori­gin.

One thought on “Deleted origin git branches aren't removed from VS2015 git

Leave a Reply

Your email address will not be published. Required fields are marked *