简体   繁体   English

如何将 tfvc 迁移到 Git,包括历史记录

[英]How to migrate tfvc to Git including history

We are planning to migrate from tfvc to Git version control.我们计划从 tfvc 迁移到 Git 版本控制。

We have some GBs of code and thousands of changesets.我们有一些 GB 的代码和数千个变更集。 I read some articles and went through Microsoft documentation and found 2 options.我阅读了一些文章并浏览了 Microsoft 文档并找到了 2 个选项。

  1. tip migration - where I can use Azure Devops built-in tool "Import Repository".提示迁移 - 我可以在其中使用 Azure Devops 内置工具“导入存储库”。 It has limitations like Imported repository should be 1GB and we can get 180 days of history.它有一些限制,比如导入的存储库应该是 1GB,我们可以获得 180 天的历史记录。

  2. Git TFS - This suites my requirement. Git TFS - 这符合我的要求。 But not sure if it can migrate entire code and entire history.但不确定它是否可以迁移整个代码和整个历史。

How can I achieve this?我怎样才能做到这一点? And are there any options other than this?除此之外还有其他选择吗?

GIT-TFS - This suites my requirement. GIT-TFS - 这符合我的要求。 But not sure if it can migrate entire code and entire history.但不确定它是否可以迁移整个代码和整个历史。

Because how TFVC and Git store the data are very different, no tool is perfect.因为 TFVC 和 Git 存储数据的方式非常不同,所以没有任何工具是完美的。 So you will have to try many things and find the way that best suits your needs.因此,您将不得不尝试很多事情并找到最适合您需求的方式。 But I'm pretty sure none will be perfect.但我很确定没有一个是完美的。

Here your really 2 options are git-tfs and git-tf.在这里,您真正有 2 个选项是 git-tfs 和 git-tf。

But with some advantages for git-tfs.但是 git-tfs 有一些优势。 See:看:

What's the difference between git-tf and git-tfs? git-tf 和 git-tfs 有什么区别?

How can I achieve this?我怎样才能做到这一点?

I can't say much than what I already put in this documentation : https://github.com/git-tfs/git-tfs/blob/master/doc/usecases/migrate_tfs_to_git.md我只能说我已经在本文档中添加的内容: https : //github.com/git-tfs/git-tfs/blob/master/doc/usecases/migrate_tfs_to_git.md

But because this kind of migration is not a perfect process, you will have to do a lot of trials and errors until you find the good way for you to do it.但是因为这种迁移不是一个完美的过程,您将不得不进行大量的试验和错误,直到找到适合您的好方法。 So start with a small history because retrieving the data from TFVC is quite slow 😕所以从一个小的历史开始,因为从 TFVC 检索数据非常慢😕

And are there any options other than this?除此之外还有其他选择吗?

There are but none is a perfect solution (but still are solutions to try)有但没有一个完美的解决方案(但仍然有解决方案可以尝试)

https://github.com/viceroypenguin/tfs-fast-export https://github.com/kunom/tfsdb-fast-export https://github.com/viceroypenguin/tfs-fast-export https://github.com/kunom/tfsdb-fast-export

If you search well you will find other custom solutions that worked 1 or 2 times for a specific migration...如果您搜索得好,您会发现其他自定义解决方案,这些解决方案可以为特定迁移工作 1 或 2 次...

tip migration - where i can use Azure Devops built-in tool "Import Repository".提示迁移 - 我可以在其中使用 Azure Devops 内置工具“导入存储库”。 It has limitations like Imported repository should be 1GB and we can get 180 days of history.它有一些限制,比如导入的存储库应该是 1GB,我们可以获得 180 天的历史记录。

The bigger is your history, the less it makes sense to migrate ALL the history.您的历史记录越大,迁移所有历史记录的意义就越小。 So it could makes perfectly sense to migrate just some months and kept the TFVC history as an archive.因此,仅迁移几个月并将 TFVC 历史记录作为存档保留是完全有意义的。

And you could also try to replicate this 'tip migration' with git-tfs or git-tf by just selecting from which changeset you want to start your migration.您还可以尝试使用 git-tfs 或 git-tf 复制此“提示迁移”,只需选择要开始迁移的变更集即可。

When the TFVC history is very strange and that you don't really need it, a last resort could be to start from the checkout of the last changeset.当 TFVC 历史非常奇怪并且您并不真正需要它时,最后的方法可能是从最后一个变更集的检出开始。 That is what Microsoft advise (even if I don't totally agree on that).这就是微软的建议(即使我不完全同意)。

The success of such migration is to be flexible, accept that it surely won't be perfect (mostly due to the insane way TFVC store the data and let you do strange things) and find the good way to move on!这种迁移的成功在于灵活,接受它肯定不会完美(主要是由于 TFVC 存储数据的疯狂方式并让您做奇怪的事情)并找到继续前进的好方法!

The git-tfs and git-tf tools work pretty well. git-tfsgit-tf工具运行良好。 Git-tfs has some good documentation in the readme. Git-tfs 在自​​述文件中有一些很好的文档。 Just bear in mind how this works, though.不过,请记住这是如何工作的。 TFS is pretty limited. TFS 非常有限。 What happens is that you will extract all of the tfs history and create a local git repository from it.发生的情况是您将提取所有 tf​​s 历史记录并从中创建一个本地 git 存储库。 From there you can put to any git remote you want.从那里你可以把任何你想要的 git 远程。 It should be able to preserve the history and author names just fine.它应该能够很好地保留历史和作者姓名。 If you are moving to git in Azure DevOps, there is a migration tool that can help you.如果您要在 Azure DevOps 中迁移到 git,有一个迁移工具可以帮助您。

Also, bear in mind that this is a popular question and has been asked before .另外,请记住,这是一个受欢迎的问题,以前曾被

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

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