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.
- 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.
- Git-TF – Required to check in our Git repo to TFVC. Add this one to your Environment Variables as well.
- Open a command prompt and type the following:
git-tf clone "https://example.visualstudio.com/DefaultCollection" "$/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.
- 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.
git-tf configure "https://example.visualstudio.com/DefaultCollection" "$/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.
- Now run the following command to check that everything is setup:
- 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.”
- 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.