Migrating TFS 2013 Source Control to Git With History

I have been recently asked by one of the client to migrate from TFS 2013 to Git. The reason for the request was TFS 2013 was massive tool and for the company size that is not fit tool to enable what is required by the client. Hence I have migrated them into GIT and everyone loves it now. Below are the simple list of procedure to migration into git using one of my sample projects.

Pre-requisites

Install gittfs using chocolatey. Run the command in the powershell cinst GitTfs

The above command will install required version of git and GitTfs for you.

Steps

  1. Created a directory C:\Temp\tfs2013migration2Git .
  2. Open the command prompt in admin mode and change directory to the above location.

    c:\Temp\tfs2013migration2Git> git tfs clone http://ditfs.cloudapp.net:8080/tfs/didemocode $/diprojectsdemo

    Initialized empty Git repository in c:/Temp/tfs2013migration2Git/diprojectsdemo/.git/

    info: no TFS root found !

    PS:perhaps you should convert your trunk folder into a branch in TFS.

    Fetching from TFS remote ‘default’…

    C2 = d9c2f2a4ee89ce1834a7a56944b85db029d2d2ac

    C3 = 9b74a439d1dfd41a1d7c3693b6bc8d8931d1f478

    C4 = 3ecb8c638e7613a4f68e3d7c61b3d00efa35d89d

    C5 = 03ed530348a1bf0eafc4ae46c1eef49b33a5a19c

    C6 = 5b0294a173cef72896796a27036c6dd79eb8e633

    C7 = 3a7a1021ad9063e755ac2d43c88b6eeac2a79c8a

    C8 = 35299452974f6282cce8ad42d74df689e689f82a

    C9 = 0d647ee90096027fd1b68859aac0e8593c626246

    C10 = 33f6bc3f683681a9f8073cd701c0f76e8d5deb5f

    C11 = 868593aeb1b0412ccb3199a57fec6afbeeaa856d

    C12 = a8a0fc6d6e44df9416a388446153b7ba19cd5152

     

  3. Download source tree https://www.sourcetreeapp.com/ and install.
  4. Open the repository you will be able to see all the changes as you see in tfs history but in the git repo refer below screenshot


  5. Make sure you have a repository available in the Github
  6. Two ways one is using the command line or soruce tree. I prefer command line for this task as shown below

    c:\Temp\tfs2013migration2Git\diprojectsdemo>git remote add origin https://github.com/mani0070/didemoprojects.git

     c:\Temp\tfs2013migration2Git\diprojectsdemo>git push -u origin master

    Counting objects: 491, done.

    Delta compression using up to 8 threads.

    Compressing objects: 100% (197/197), done.

    Writing objects: 100% (491/491), 936.01 KiB | 0 bytes/s, done.

    Total 491 (delta 227), reused 491 (delta 227)

    To https://github.com/mani0070/didemoprojects.git

    * [new branch] master -> master

    Branch master set up to track remote branch master from origin.

    c:\Temp\tfs2013migration2Git\diprojectsdemo>

     

  7. Add the remote to the Git local repository as shown below


  8. Push the changes using source tree as shown below

    Now, if you loign to the github account you can see the below code


    Now, we have migrated all the code from TFS 2013 into GitHub. If you have any question please comment on the post happy to answer.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.