1

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".

Andrew Stephens
  • 9,413
  • 6
  • 76
  • 152

1 Answers1

0

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).

Hugh Lin
  • 17,829
  • 2
  • 21
  • 25
  • The MS "TFVS to Git migration" documentation recommends not to migrate the history, so does the above command have a switch to exclude history? If not, what are the downsides of migrating the history? – Andrew Stephens Nov 20 '19 at 09:57
  • Clone a specific changeset (without history),you can use [quick-clone](https://github.com/git-tfs/git-tfs/blob/master/doc/commands/quick-clone.md) command.This [document](https://learn.microsoft.com/en-us/azure/devops/learn/git/migrate-from-tfvc-to-git#advanced-migrations) list the limitations with this migration. – Hugh Lin Nov 20 '19 at 10:15
  • Also, silly question but how do I specify where to clone to? Using the above command I get the error "Specified git repository directory is not empty". If I replace the "." with a path to an empty folder then I get "The system cannot find the file specified". – Andrew Stephens Nov 20 '19 at 10:15
  • You can follow this [guide](https://github.com/git-tfs/git-tfs). – Hugh Lin Nov 20 '19 at 10:22
  • If I was to use the quick-clone command, would it still migrate all branches and allow me to merge between those branches? – Andrew Stephens Nov 20 '19 at 11:31
  • 1
    quick-clone command can't migrate all branches.As stated in the docs, it will take the specified repo(path) and take the specified changeset as version, and doesn't take any history information along (so no branches). The method in this [case](https://stackoverflow.com/questions/39772578/git-tfs-can-i-clone-all-branches-but-skip-the-history) works for you. – Hugh Lin Nov 21 '19 at 02:10