a·gen·tic a·gil·i·ty

Migrating source code with history to TFS 2012 with Git-Tf

Guide to migrating source code and preserving history from one Team Foundation Server (TFS) 2012 instance to another using Git-Tf and Git command-line tools.

Published on
2 minute read
Image
https://nkdagility.com/resources/tiIa1A7zPP-
Subscribe

Its hard to migrate source code even from one Visual Studio 2012 Team Foundation Server to another, especially when you also want to have your history. We have been forced in the past to use some hokie migration tools that only really partially work.

With Git-Tf we can Clone a Team Foundation Server repository and with plane old Git we can do a Pull from one to the other and then push up to our target repository.

Migrating source code with history to TFS 2012 with Git-Tf

Figure: Running Git from the Command Line

The first thing we need to do in install Git-Tf and its dependencies. This will add the Git Bash command line and the TFS integration required to connect everything up. This is really me first time using Git as I have just not had time to play with it, but it looks solid so far.

Migrating source code with history to TFS 2012 with Git-Tf

Figure: Install with the cint Git-Tf command line call

When you clone a Team Foundation Server repository you can either get the tip or you can go deep. If you add the –deep  parameter on end you will effectively clone the history as well. For this particular task I only need the tip and I am really only need to go one way. You can however push source code back and fourth at will between the two servers or any other environment. A browse of the internet will also show you other source control systems that you can clone to Git. If you can clone you can pull and if you can pull you can checkin…

1git tf clone https://mrhinsh.visualstudio.com/DefaultCollection $/TfsExtensions/TfPlugable ~/wsgitmrhinshTfPlugable
2git tf clone http://kraken:8080/tfs/tfs01 $/TfsExtensions/TfPlugable  ~/wsgitkTfs01TfPlugable
3git pull ~/wsgitmrhinshTfPlugable
4git checkin

Figure: Git commands to move from TFS to TFS

1git tf clone https://nakedalm.visualstudio.com/DefaultCollection $/TfsExtensions/TfPlugable c:\temp\TfPlugable
2cd C:\Users\MrHinsh\Source\Repos\TfPlugable
3git remote add tfplugable-tfvc-branch c:\temp\TfPlugable
4git pull tfplugable-tfvc-branch master --deep
5git checkin

Figure: Git commands to move from TFVC to TFS Git

The result of this is a move from my Team Foundation Service cloud account to my local test Team Foundation Server virtual machine.

If you are trying to move your source code from anything to Team Foundation Server this may be a good option. Its robust and will bring history across. I have not tested this at load but it should support reasonable sized repositories, large however will need some testing…

Software Development
Subscribe

Related Blog

No related videos found.

Connect with Martin Hinshelwood

If you've made it this far, it's worth connecting with our principal consultant and coach, Martin Hinshelwood, for a 30-minute 'ask me anything' call.

Our Happy Clients​

We partner with businesses across diverse industries, including finance, insurance, healthcare, pharmaceuticals, technology, engineering, transportation, hospitality, entertainment, legal, government, and military sectors.​

Illumina Logo

Illumina

YearUp.org Logo

YearUp.org

Teleplan Logo

Teleplan

Deliotte Logo

Deliotte

ProgramUtvikling Logo

ProgramUtvikling

Lockheed Martin Logo

Lockheed Martin

Kongsberg Maritime Logo

Kongsberg Maritime

Philips Logo

Philips

Boeing Logo

Boeing

Boxit Document Solutions Logo

Boxit Document Solutions

MacDonald Humfrey (Automation) Ltd. Logo

MacDonald Humfrey (Automation) Ltd.

Flowmaster (a Mentor Graphics Company) Logo

Flowmaster (a Mentor Graphics Company)

Cognizant Microsoft Business Group (MBG) Logo

Cognizant Microsoft Business Group (MBG)

CR2

Genus Breeding Ltd Logo

Genus Breeding Ltd

Graham & Brown Logo

Graham & Brown

DFDS Logo

DFDS

Slaughter and May Logo

Slaughter and May

Washington Department of Enterprise Services Logo

Washington Department of Enterprise Services

Ghana Police Service Logo

Ghana Police Service

Nottingham County Council Logo

Nottingham County Council

New Hampshire Supreme Court Logo

New Hampshire Supreme Court

Department of Work and Pensions (UK) Logo

Department of Work and Pensions (UK)

Royal Air Force Logo

Royal Air Force

YearUp.org Logo

YearUp.org

Milliman Logo

Milliman

DFDS Logo

DFDS

Cognizant Microsoft Business Group (MBG) Logo

Cognizant Microsoft Business Group (MBG)

Qualco Logo

Qualco

Capita Secure Information Solutions Ltd Logo

Capita Secure Information Solutions Ltd