Moving code from one hosted Team Services (TFS) instance to another

Moving your code (with history) from one hosted TS instance to another is a bit easier then migrating from SVN to TS so let’s get right to it.

Required Tools:

  1. Git – The Git command line tools. Don’t forget to add the Git bin directory to your Environment Variables path variable so you can just type git in a command prompt without having to give the full path.
  2. Git-TF – Required to check in our Git repo to TFVC. Add this one to your Environment Variables as well.
  1. Open a command prompt and type the following:
    git-tf clone "" "$/Your/Project/Path" --deep
    This will clone the project you want to move to your drive so be sure to have the current directory in the command line set to where you want the files on your computer.
  2. Disassociate the Git Repo that you just created from the TS server by deleting the .Git/tf folder and the .Git/git-tf file and by removing the git-tf sections from the config file.
  3. git-tf configure "" "$/Your/Project/Path" --deep
    We are now telling git-tf where we want the files to go when we check-in. It is very important that we have first removed the original source repo references as mentioned in step 2.
  4. Now run the following command to check that everything is setup:
    git-tf pull
  5. At this point you should see a message similar to,
    “You should get a message at this point “git-tf: this is a newly configured repository. There is nothing to fetch from tfs.”
  6. Lastly run this bit and your source will start getting checked in:
    git-tf checkin --deep --metadata --no-lock --keep-author
    Note: You may run into one more step after this if all the users in your Git repo cannot be mapped to TFS. If this does happen git-tf will generate a USERMAP file that you need to alter to map the unmapped users and then you can enter the checkin command again.
  7. Done!

Leave a Reply

Your email address will not be published. Required fields are marked *