Migrate TFS 2013 to Git

倾然丶 夕夏残阳落幕 提交于 2020-12-12 03:58:24

问题


During the past 24 hours I've been struggling with the following.

As our dev team uses TFS (current version 2013) for quite some time, we decided to migrate all of the projects to git.

But unfortunately, this doesn't look to be so easy. First of all, I've tried with git tfs, but every time I try to clone a collection it says:

Access to path 'x' denied. 

In contrary, listing all of the branches runs smoothly.

Because of that, I was trying to go the way around by trying to convert a TFS repository into a TFS Git repository which would allow me to clone it and push it to our BitBucket repo. Unfortunately, I cannot find how to convert a TFS repository to a TFS Git repository - only found how to create an existing.

Last but not least, I have even tried with git tf - but every time I try to access my repos it says: "Java....Main.class" not found.

Any tips and tricks onto how to successfully migrate from TFS to Git?

Thanks in advance!


回答1:


TFVC and Git are radically different version control models (see https://en.wikipedia.org/wiki/Version_control for additional information): it is like moving your data from Files&Directory to a Relational DBMS or comparing an electric car to an internal combustion engine.

My suggestion is going back to the basics and state the requirements clearly. :

  • Do I need to migrate all my source code?
  • Do I need migrate history?
  • Do I need all the branches?

My recommendation is to focus on what you really need and go for quickest and cheapest solution which is usually:

  1. Move to the new system only the source files I need and get rid of old unused stuff (call it garage cleaning)
  2. Lock down the old system to be read-only
  3. Take a snapshot of a minimum of branches and commit them to the new system (no special tools needed)
  4. Do not migrate before a major release, choose the moment wisely so teams have time to learn the new technology and fix issues
  5. Start using the new system and leave the old as a reference

Item 2 can be implemented by removing permissions to everyone except administrators. My idea of step 3 is: clone empty repo, get latest of main branch in separate TFVC workspace, sync the files to the Git repo (e.g. robocopy /MIR /XD .git), commit, push, create and switch Git to branch X, get latest TFVC branch X, sync, etc. Repeat for all the branches you want to migrate.

Consider also some minor refactoring of the code base layout and splitting into separate Git sub-trees or even sub-modules.




回答2:


Unfortunately, I cannot find how to convert a TFS repository to a TFS Git repository

Just because there is no way to do it! It's a very difficult task, due to git and TFVC specificities, so Microsoft never even tried to do it!

In a sense, that's what the tools git-tfs and git-tf are trying to do with a lot of difficulties, mostly due how (horrible!) TFVC manage and store branches data in it's repository.

Your only hope is in one of this 2 tools.

Unfortunately, git-tf is no more supported since 2 years and do not support branches :-(

git-tfs try to do a lot better job but some branch patterns still cause big problems :-( In this last resort case, clone without branch support is your last solution...

Some doc on how to do it https://github.com/git-tfs/git-tfs/blob/master/doc/usecases/working_with_no_branches.md#clone-just-the-trunk

Feel free to read more doc on git-tfs github site.

Access to path 'x' denied.

Are you sure that it is not just some rights access problem? Because I never heard of such a problem...

Ps: the way Microsoft see the migration from TFVC to git, is to update to tfs 2015 update 2 and to create a git repository into the same project than the existing TFVC project and copy the source code to the git repository. TFVC keeping the history... If needed.



来源:https://stackoverflow.com/questions/34798577/migrate-tfs-2013-to-git

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!