X
07Aug

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 : https://gittf.codeplex.com/ or http://www.microsoft.com/en-us/download/details.aspx?id=30474  and set its environment variable.

3.      Download and Install Git using the link : https://github.com/msysgit/msysgit/releases

Set the Environment variable for command line based prompts:

For GIT:

Set PATH: C:\Program Files (x86)\Git\bin\

Set GIT: C:\Program Files (x86)\Git\

For JAVA:

Set PATH: C:\Program Files (x86)\Java\jre7\bin

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.

01

 

02

 

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

 

03

 

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:\migrate\git

 

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.

 

04

 

8.  Run the command in the same prompt as:

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

05

          

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.

 

06

 

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

07

 

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

08

 

 

Related

Accelerating Digital Transformation with GitHub

Hi All, in this blog I would like to share few insights on how you can leverage GitHub for your deve...

Read More >

GitHub Product Purchasing Details

In the previous blog we would have seen what GitHub is, who started this project and how it evolved ...

Read More >

Intro to Git and GitHub and Difference

Let us check what is Git and GitHub and how they work. To understand this, let us imagine a scenario...

Read More >

Git Command line Options

Git is a free and open source distributed version control system designed to handle everything from ...

Read More >

Migration Process of SVN to Git

Subversion (SVN) is a central version control system (VCS) while Git is a distributed version contro...

Read More >

GitHub - Administration

To understand GitHub, you must first have an understanding of Git. Git is an open-source version con...

Read More >

Integration of Git into Visual Studio

Nearly all versions of the Visual Studio IDE provide integration features for source control. Git Cl...

Read More >

How to Prevent Users from Moving Task to Closed State with a non-Zero value Remaining Work field in VSTS/TFS

In this Blog I am going to explain how we can customize Task in VSTS/TFS to Prevent Users from Movin...

Read More >

Dashboard Migrator Tool

This is a web service which helps you to copy the VSTS dashboards from 1 team to another team easing...

Read More >

Canarys Automations Pvt Ltd recognized as finalist for 2017 Microsoft DevOps Partner of the Year Award

  Bengaluru, Karnataka, India — June 2, 2017 — Canarys Automations Pvt Ltd tod...

Read More >

Share

Post a Comment

  • Recent
  • Popular
  • Tag
Tags
Monthly Archive
Subscribe
Name

Text/HTML
Text/HTML
Contact Us
  • *
  • *