Migrate a TFVC repository to GIT

in Team Foundation Server or Visual Studio Team Services

Todoay I got the task to migrate sources from an on-premise TFS instance running TFVS to GIT in a Visual Studio Team Services (VSTS) instance. I managed to migrate all the sources with full history. In this blogpost I will explain how I did that migration.

 

Preparations

To do a migration from TFVS to GIT you need to have a couple of applications in place. I used the following tools:

 

Installation

Java and GIT are comming with an installer. You can use the installer to install the tools with the default configuration.

GIT-TF needs a manual installation. You can use the following steps to install GIT-TF:

  1. Extract the contents of the .zip file to a folder on your machine, i.e. C:/GIT-TF
  2. Add the path where your extracted GIT-TF (i.e. C:/GIT-TF) to you PATH environment variable
  3. Add he path where java.exe is installed to the PATH environment variable.

You are now ready to use GIT-TF and do a migration from TFVC to GIT.

Migration

The migration is easy to do. There are actualy two steps to complete te migration. In the first step you need to create a local git repository of the TFVC repository with GIT-TF. The second step is pushing the local GIT repository to the GIT master (in Visual Studio Team Services or TFS).

 

Step 1: Creating a local GIT repository from a TFVS repository

The commands below are used to create a local GIT repository out of a TFVS repository. Please not that the execution of the “GIT-TF” command may take a while. The more changesets are checked in to TFVS, the longer the execution of this command will take.

Step 2: Pushing the local GIT repository to the GIT master

The commands below are used to push the local GIT repository to the GIT master. Please note that these commands can be found on the GIT repository page in TFS.

Results

As a result of this migration all sources from a specific branch in TFVC are migrated to GIT in TFS/VSTS. Dates and users are visible in TFS/VSTS when you click on “view history” for a file.

Please see my screenshot as prove!

Share This