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.)
- Git-TF
- The official tool created and maintained by Microsoft that supports TFS/Git integration
- http://gittf.codeplex.com/
- Git-TFS
- An open source tool to bridge between Git and TFS, similar to git-svn
- https://github.com/git-tfs/git-tfs
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
- git tfs list-remote-branches http://tfsold:8080/tfs/DefaultCollection
- Clone the full repository or a specific branch(note that this can take a while…)
- git tfs clone http://tfsold:8080/tfs/DefaultCollection $/some_project
- 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
- git-tf configure http://tfsnew:8080/tfs $/some_project
- Do a check-in of the Git repo in TFS
- git-tf checkin --deep --verbose