Search code examples
azure-devopsazure-devops-server-2019

Migration from TFVC to Git - how does it handle branches?


I'm looking into migrating our TFVC repository to Git using the "Import" option provided in Azure DevOps (Repos -> Files -> [New Git Repository] -> 'Import' button).

Our TFVC repo currently has two branches:

$/MyProject/Dev
$/MyProject/Release_1.0  (currently our one and only production version)

The documentation for the "import" option (here) says that "only a single branch will be migrated". If so, how can I migrate both branches to my new Git repository and keep the "relationship" that the branches have with each other? i.e. once in Git I still want to be able to (say) fix a bug in the "Release_1.0" branch and merge the change back into "Dev".


Solution

  • For this issue, agree with Daniel , you can use git-tfs to achieve this migration.

    First fetch all the source history (with all branches) in a local git repository:

    git tfs clone http://tfs:8080/tfs/DefaultCollection $/project/trunk . --branches=all
    

    Wait quite some time, fetching all the changesets from TFS is even longer.

    Pros:

    • you have all the whole history in the git repository
    • manage merges between branches! A branch merged in another one will be materialized in the git repository.

    For details ,please refer to this document and issue(clone multiple TFS branches into one Git repo).