简体   繁体   English

Azure DevOps TFVC 到 Git 迁移

[英]Azure DevOps TFVC to Git Migration

We are looking into the possibility of migrating from TFVC to GIT in Azure DevOps.我们正在研究在 Azure DevOps 中从 TFVC 迁移到 GIT 的可能性。 There is a tool that looks like it should work for us, but it will not move the source code to the repository it creates.有一个工具看起来应该对我们有用,但它不会将源代码移动到它创建的存储库中。 Our TFVC source tree resembles the below structure.我们的 TFVC 源代码树类似于以下结构。

  • $/Contoso $/Contoso
  • $/Contoso/GreatApp1 $/Contoso/GreatApp1
  • $/Contoso/GreatApp1/Main (Branch) $/Contoso/GreatApp1/Main(分支)
  • $/Contoso/GreatApp1/Main/Source (folder with source code) $/Contoso/GreatApp1/Main/Source(包含源代码的文件夹)
  • $/Contoso/GreatApp1/Main/Documentation (project documentation) $/Contoso/GreatApp1/Main/Documentation(项目文档)
  • $/Contoso/GreatApp1/Dev (Branch) $/Contoso/GreatApp1/Dev(分支)
  • $/Contoso/GreatApp1/Dev/Source (folder with source code) $/Contoso/GreatApp1/Dev/Source(包含源代码的文件夹)
  • $/Contoso/GreatApp1/Dev/Documentation (project documentation) $/Contoso/GreatApp1/Dev/Documentation(项目文档)

At the very least, I would like to convert the Main branch with documentation and source code.至少,我想用文档和源代码来转换 Main 分支。 We have 40-50 projects that follow this structure under a single project collection, so ideally I am hoping to do this using this tool without having to rebind source control in all of the different projects.我们在一个项目集合下有 40-50 个遵循这种结构的项目,所以理想情况下,我希望使用这个工具来做到这一点,而不必在所有不同的项目中重新绑定源代码控制。 Is what I'm wanting to do possible?我想做的事可能吗?

The import experience is optimized for small, simple TFVC repositories or repositories that have been prepared for a migration.导入体验针对小型、简单的 TFVC 存储库或已准备好进行迁移的存储库进行了优化。 This means it has a few limitations.这意味着它有一些限制。

  1. It only migrates the contents of root or a branch.它只迁移根目录或分支的内容。 For example, if you have a TFVC project at $/Fabrikam which has 1 branch and 1 folder under it, a path to import $/Fabrikam would import the folder while $/Fabrikam/<branch> would only import the branch.例如,如果您在$/Fabrikam有一个 TFVC 项目,该项目下有 1 个分支和 1 个文件夹,则导入$/Fabrikam的路径将导入文件夹,而$/Fabrikam/<branch>只会导入分支。
  2. The imported repository and associated history (if imported) cannot exceed 1GB in size.导入的存储库和关联的历史记录(如果已导入)的大小不能超过 1GB。
  3. You can import up to 180 days of history.您最多可以导入 180 天的历史记录。

If you want to attempt an advanced migration with Git-TFS , that project provides documentation on how to do a migration from TFVC to Git, cloning a single branch with history or cloning all branches with merge history .如果您想尝试使用Git-TFS进行高级迁移,该项目提供了有关如何从 TFVC 迁移到 Git、 克隆具有历史记录的单个分支克隆具有合并历史记录的所有分支的文档。

let's follow the migration guide and execute the clone command:让我们按照迁移指南执行克隆命令:

git tfs clone {TFVC repo URL}

Get all branches:获取所有分支:

git tfs branch –init --all

For each branch, run these commands:对于每个分支,运行以下命令:

git checkout branch

git log -1

git tfs pull -c=changesetNumber

Create a new repo in the azure devops and get the repo URL.在 azure devops 中创建一个新的 repo 并获取 repo URL。 Then setup the git repository upstream:然后在上游设置 git 存储库:

git remote add origin {New repo URL}

Finally you push all your local changes to the Remote.最后,您将所有本地更改推送到远程。

git push origin -u -all

Useful link:有用的链接:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM