Migrating a TFVC team project to a Git team project along with changeset history in TFS.
Want to migrate a TFVC Team Project to GIT, along with history? It's simple!
Follow the blog to get step by step procedure on how to do it.
Requirements:
1. You need to have GIT installed on your machine.
You can download GIT for windows at : https://git-scm.com/download/win
2. You need to have contents of git-tf. (You can set the environment variables)
Download from https://gittf.codeplex.com/
Steps:
1. Create a new Team Project with GIT as version control.
In my example I am moving TEAM Project from: the team project name "Apchintfs2013 Team Project" to GIT team project named "ToGit"
URL: https://apchintfs2013:8080/tfs/DefaultCollection/ApchinTfs2013%20Team%20Project
to
https://apchintfs2013:8080/tfs/DefaultCollection/ToGIT
2. If you haven't set the environment variables for git-tf, navigate to the path where you have git-tf downloaded and extracted.
Open a Command Prompt and run the below command:
Git-tf clone " https://<TFS Server Name>:Port/tfs/<CollectionName> "$/TeamProjectName" --deep
--deep : Flag used to clone each TFS change-set for the specified path into the new Git repo
In my example:
Git-tf clone https://apchintfs2013:8080/tfs/DefaultCollection/ "$/ApchinTfs2013 Team Project" --deep
3. After running the clone command, you'll have all the projects downloaded in your local machine from TFVC Team Project,
now you need to push it to the GIT repository.
Before anything is pushed ToGit team Project web access will look as below.
4. Open the GIT BASH when you would get after installing as mentioned in Step 1.
Navigate to the path where you had cloned the TFVC team project (refer above command).
As soon as you go to the repository, you'll see a MASTER branch appear in the command prompt.
This is a que that it is a GIT repository now.
5. You need to push this to the GIT repository on TFS.
Run the below command to first add the GIT repository and then push it to TFS server.(Here Master is the default branch which is created whenever you have a git repository)
Git remote add " https://TFSServerName>:port/tfs/Collectionname/_git/<GITRepositoryName> "
Git push origin master
In my example:
Git remote add " https://apchintfs2013:8080/tfs/DefaultCollection/_git/ToGit "
Give in the Username and Password with which you authenticate on On-Premise TFS.
(If you are using VSO account, you need to give Alternate Credentials instead)
Now, if you navigate to your GIT Team Project, you should be able to see all the projects along with the change-set history.
You now have a GIT Team Project which was migrated from TFVC Team Project!
Cheers!
Content created by – Aparna Chinya
Content reviewed by – Romit Gulati
Comments
Anonymous
August 24, 2015
Hm, if you had a couple of branches inside of TFVC project (say 40), would not this approach treat them as simple directories? How would you migrate them to have a set of git branches in the end with proper history?Anonymous
October 04, 2015
@David Have a look to 'git-tfs' instead of 'git-tf' that support some tfs branch strategies (and add some other interesting features)