Canarys | IT Services


Migrating TFS 2013 Version Control to TFS Git with changeset history

There are several articles on the web describing the migration technique with minimal details. This article is an effort to provide the complete information to successfully migrate from the TFS VC to the TFS GIT VC.

TFS ‘out-of-the-box’ does not provide any tools to export import source code or changesets. Usually, if we want to move current source code, we can get the latest source to a machine, un-bind the source, check-in to new location. For the work items, we can export the required work items to Excel and import them into the new Team project.

But this method does not bring source control history or work items history along with it when moved across. We need to have the existing old team project and refer it every time for history or associations.

With the arrival and availability of GIT with TFS, we have options of migrating source code with history and no data loss.  GIT repository clone is a complete copy of the source code and not just the current version. There is no time compression (old check ins to a new location will appear as though they have been done at the time of migration) with the local GIT repository.

The following are not available with migration of TFSVC to GIT :

1.      Work items original number in TFVC wont appear in GIT

2.      Associations of TFVC changeset to work items cannot be retained in GIT

Let us look at the detailed way of migrating a project from TFVC to GIT –

Pre-requisites for the migration activity :

1.      Download and Install the latest version of Java sdk and set its environment variable.

2.      Download and Extract the contents of git-tf from the site : or  and set its environment variable.

3.      Download and Install Git using the link :

Set the Environment variable for command line based prompts:

For GIT:

Set PATH: C:Program Files (x86)Gitbin

Set GIT: C:Program Files (x86)Git


Set PATH: C:Program Files (x86)Javajre7bin

Open command prompt and type “git/java” and hit enter. You should be able to see a list of git/java related commands if the environment variable is set correctly.

2.  Create a Team Project in TFS which uses GIT as its source control and the same Process template methodology as the TFVC project.



3. Before we start the conversion, we need to clone the GIT repository which creates a mapping between local code repository and server repository.


4.  Let us now move an existing TFS Version Control Team Project to TFS based GIT repository. My example of TFVC here is Fabrikam Fiber Project under FabrikamFiber Collection.

5. We need to make use of the respective Team Projects’ URL which can be obtained from their web access URLs. In this example,

For FabrikamFiber(TFVC) ,  the URL is : http://vsalm:8080/tfs/FabrikamFiberCollection/FabrikamFiber

For GitConversion(GIT), the URL is : http://vsalm:8080/tfs/FabrikamFiberCollection/GitConversion

6. We shall make use of a local folder for the migration . In this case, the folder name is git inside another folder, i.e, C:migrategit

7. Clone the TF Version Control source into the new local Git repository –

i) Open Command Prompt in Administrator Mode

ii) Navigate to the local parent folder(Here “migrate” folder) which was created for migration

iii) Run the command:

git-tf clone http://vsalm:8080/tfs/fabrikamfibercollection $/fabrikamfiber/Main git –deep 

  where :

git-tf : Command used for cloning a selected repository into destination

http://vsalm:8080/tfs/fabrikamfibercollection : URL of the TF Version Control Team Project

$/fabrikamfiber/Main git : is the GIT repository path

git : Local folder where the code from TF Version Control Project is copied.


8.  Run the command in the same prompt as:

git remote add origin http://vsalm:8080/tfs/FabrikamFiberCollection/_git/GitConversion



The URL can be obtained from “Code” tab of the GIT Team Project Web Access URL and is usually of the format –

http:// <>/tfs/<>/_git/<>

Note : If there is an error while issuing the above command, you don’t have to start over again. We can remove the repository by the following command and give the correct command.

To remove the origin ( Origin is the local name of the remote repository)

git remote rm origin

To remove only the branch of the origin

Git remote rm <>

9.  Run the command:

 git push -u origin –all

On clicking enter, a prompt to enter username and then password should appear. Once the correct credentials are entered, code push should start and complete.


10. Before Migration, the Git Team Project “Code” tab in Web Access URL would look like –



After Migration, the Git Team Project “Code” tab in Web Access URL with all History intact after migration  would look like –


Leave a Reply

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

Reach Us

With Canarys,
Let’s Plan. Grow. Strive. Succeed.