Migrate TFVC to Git

Git is now the default version control provider for new Team Projects and it should be your first choice for version control unless you have a requirement for centralized version control system (TFVC).

If you want to migrate from TFVC to Git you can use the git-tfs utility.  You can use two methods to install git-tfs, one of which is to use Chocolatey.  I’ll open a command prompt to run choco install gittfs


choco install gittfs

You can verify it’s installed by typing the command git tfs help


git tfs help

First I’ll change directories into where I keep all of my other Git repos and then issue a list remote branches command to list all of the TFS branches that could be cloned


git tfs list-remote-branches

For this post I’m going to clone AIDEMO by executing the following command

git tfs clone https://like10.visualstudio.com/ $/AIDEMO


git tfs clone

Now that I have cloned it locally I should create a new Git repository in VSTS to push all the changes to


Create a new (empty) repository



choco install gittfs

Now we’ll add a remote to my local git repository and push all of the changes

  1. I make sure I’m in the AIDEMO folder
  2. git remote add origin https://like10.visualstudio.com/DefaultCollection/_git/AIDEMO
    NOTE:  You can get the Clone URL as shown in the screen capture above
  3. git push –all origin



git remote add origin


Ths is great except now we have the entire repository cloned but because we cloned from the root of the project we cannot manage branches.  Take a look at the screenshot below and you’ll immediately see what I mean:


Why are both of my branches is master?



Let’s try again but this time we’ll specify $/AIDEMO/main so we can manage our branches.  Open a prompt and execute the following command, this time specifying the root branch:

git tfs clone https://like10.visualstudio.com/ $/AIDEMO/main try4 –branches=all


git tfs clone –branches=all

Now I can change directories into the folder where I did the clone and list all of the branches in my local repository by executing the git branch command I can see both master and dev branches


git branch or git branch -v

Now I’ll create an empty Git repository in VSTS called AIDEMO5 and configure that as my remote by executing the following commands:

  • git remote add origin https://like10.visualstudio.com/DefaultCollection/AIDEMO/_git/AIDEMO5
  • git push –all origin

Here is the result of running those commands


git push –all origin

Now if we take a look at the Code Hub in VSTS we should see both of our branches


Code Hub with both branches

Here is a link to some documentation which goes into more details and some of the different options:


Good luck!



About Wes MacDonald

Wes MacDonald is a DevOps Consultant for LIKE 10 INC., a DevOps consulting firm providing premium support, guidance and services for Azure, Microsoft 365 and Azure DevOps.

No comments yet... Be the first to leave a reply!

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 )

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: