Connecting to a remote Git branch from Visual Studio

When you first connect to a Git Repository in Visual Studio, you are going to be defaulted to cloning the Master remote branch.  But what if you want to work on a different branch?    You’ll need to clone that branch before you start working on it.  If you look at the branches tab in Team Explorer, you probably only see the one branch and see no sign of the other branches:

But in Visual Studio Online, I see 3 remote branches:

Well, before you can see the branches locally, you need to create a local tracking branch for the remote branch.  You could do this with command-line: git branch dev –track origin/dev

You can also do this right from Visual Studio.  First, click on “New Branch”

Then select the remote branch from the drop-down list, this will auto-populate the branch local name. You can change the name of the local branch if you want since it’s just a mapping:


And click on Create Branch.

Now you have your local branch and you can start making changes and pushing/pulling with your remote branch.

If you want to get started with Git and be successful with it, while staying in Visual Studio, I created a Pluralsight course that you may want to check out: Git for Visual Studio Developers.

About esteban

Esteban is the Founder and Chief Technologist at Nebbia Technology, an ALM consulting and Azure-powered technology company. He is a software developer with a passion for ALM, TFS, Azure, and software development best practices. Esteban is a Microsoft Visual Studio ALM MVP and ALM Ranger, Pluralsight author, and the president of ONETUG (Orlando .NET User Group).

4 thoughts on “Connecting to a remote Git branch from Visual Studio

  1. Dew Drop – December 11, 2014 (#1913) | Morning Dew

    […] Connecting to a remote Git branch from Visual Studio (Esteban Garcia) […]

  2. vishal yadav

    Thank you very much!!
    Helped me a lot

  3. Bob

    thanks man this is amazing

  4. shahab

    Thank you So much.. So much helpful and indeed clearly explaind.

Leave a Reply

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

Are you human? *