If you’ve been using Git from within Visual Studio 2017 you might be aware of the fact that when performing a fetch it would not automatically prune your local list of branches that no longer exist on the server. Typically you would have to open up a Command Prompt and run the following command to cleanup your list of branches that exist on the remote:

> git remote prune origin

image

Well now with Visual Studio 2017 Update 5 you can now configure your global and repository settings to prune your local list of branches on every fetch. Let’s take a look at how you can configure this.

First download and install Visual Studio 2017 Update 5. You can do this from within Visual Studio under the Tools menu:

image

Once you have Visual Studio 2017 Update 5 installed, go to the Team Explorer pane and click on Settings where you can configure your default behavior for your Global and/or Repository Settings:

image

image

Now you can change the setting to prune remote branches on every fetch. In my opinion this should be the default value.

image

Another nice addition to the Git settings in Visual Studio 2017 Update 5 is the ability to Rebase your changes when you pull. I’ll explore that in a future post.

In summary when enabling the prune on every fetch, this means your local list of branches is always up-to-date with the remote. Pruning will cleanup and remove your local tracking branches that no longer exist on the server.

Enjoy!

References

Git Configuration: Configure your default behavior

Posted by Callon Campbell [MVP]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s