Monday, May 18, 2015

Team Foundation Server: How to migrate TFS Version Control project by project

One of the customers I work for is making the move to Team Foundation Server. For the project I’m working on, we used a temporal TFS project hosted at my employer(Ordina). Unfortunately there wasn’t an easy migration path to move the source code from the Ordina TFS to the TFS at the customer location. Why? Because we are using SQL Server 2014 and the customer has standardized on SQL Server 2012. And this is an unsupported migration path.

Luckily, I found a workaround to not lose any history. In short, what I do is export all the source code in TFS Version Control(TFVC) from my company’s TFS to a Git Repo. Afterwards I import the code from Git  into the TFSVC from the customer.

Interested in the specific steps? Here are all the details:

Prerequisites

I used a combination of 2 tools that support integration between TFS and Git. (Why 2 tools? Because I had some issues when I tried to accomplish the process with only one of the tools.)

Export the code from TFSVC into Git using Git-TFS

  • Download and install the Git-TFS binary
  • Add the git-tfs folder path to your PATH environment variable
  • Open a command prompt
  • Check which branches are available for cloning
  • Clone the full repository or a specific branch(note that this can take a while…)
  • After the clone operation has completed, you have the full TFS history available in a local git repo

Import the code from Git into TFSVC using Git-TF

  • Let’s now switch to the Git-TF tool. Download and install it from the Microsoft Download site.
  • Add the Git-TF installation path to your PATH environment variable
  • Open a command prompt
  • Browse to the location where you have the local git repo created
  • Configure git-tf to link to the target tfs repo
  • Do a check-in of the Git repo in TFS
    • git-tf checkin --deep --verbose

2 comments:

Kas said...

Thanks for these detailed steps.
But am unable to proceed checkin from Git to New folder of TFS.
git-tf checkin --deep --verbose
git-tf: the repository is not up to date. Please fetch and rebase/merge changeset 8773

But it is another folder of TFS and didn't have anything in it.
So, How I can push my this cloned git repository into new TFS folder.
Your prompt help is truly appreciated.
Thanks.

Urs said...

I have the same problem!
"the repository is not up to date. Please fetch and rebase/merge"
How to solve this?
Thanks