Migrate Source code from TFS TFVC to GIT


This document defines the steps to be followed to migrate source code from TFVC to TFS-Git repository along with change set history


Here the Source is TFVC repository


Here the Target is TFS GIT repository


Following are the Pre-Requisites for the migration:

  • Chocolatey package manager
  • GIT
  • GIT-TF tool
  • GIT Repository in TFS

What is Chocolatey package manager?

Chocolatey is a package manager for Windows. It is used for quickly installing applications and tools that we need. It is built on the NuGet infrastructure currently using PowerShell.

Chocolatey is an interface that is designed to work with all aspects of managing Windows software using a packaging framework that understands both versioning and dependency requirements.


  • Open Command Prompt as Administrator
  • Install Chocolatey package manager by running the below command:

@powershell -NoProfile -ExecutionPolicy Bypass -Command “iex ((New-Object System.Net.WebClient).DownloadString(‘https://chocolatey.org/install.ps1’))” && SET “PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin”

  • Install GIT-TF Tool by running the below command in the same command prompt that was used to install Chocolatey package manager

Choco install git-tf –y

Along with git-tf tool even GIT is installed

  • Now change the path from C:\Windows\system32 to git-tf installed path (by default the GIT-TF would be installed in C:\ProgramData\chocolatey\lib\Git-TF\Tools\git-tf- Here git-tf- is git-tf tool version).

So in my case I changed the path from C:\Windows\system32 to C:\ProgramData\chocolatey\lib\Git-TF\Tools\git-tf-

  • After changing the path run the git-tf clone command as below:

Git-tf clone “http://TFS Server Name:Port/tfs/” “$/TeamProjectName” –deep

Note: –deep: Flag used to clone each TFS change-set for the specified path into the new Git repo

After running the clone command, you’ll have all the projects downloaded in your local machine from TFVC Team Project (Path would be the installed path of GIT-TF tool/Tools/Project Name)

  • Now Open GIT Bash as Administrator from Search and change the path where TFVC project is downloaded

Note: GIT BASH is installed along with GIT-TF tool

  • As soon as change the path, you’ll see a MASTER branch appear in the GIT Bash.

  • Create a GIT repository in TFS
  • You need to push this to the GIT repository on TFS.
    Run the below command to first add the GIT repository and then push it to TFS server. (Here Master is the default branch which is created whenever you have a git repository)

Git remote add origin TFS server name:PortNumber/tfs/CollectionName/TeamProjectName/_git/GITRepositoryName

  • Refresh the browser and open the GIT repository where you wanted the source code along with the changeset history to be migrated


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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s