Clone GIT to TFS (AzureDevOps) with git-tfs

房东的猫 提交于 2020-02-25 08:19:09

问题


we have an local DevOps Server 2019 with our old projects and I am able to clone this projects with git-tfs to local Git repositories. Everything is fine. After that I can push this repositories to our AzureDevOps Git repositories. Everything ok.

Now we have some projects and colleagues who want to use TFVC for these special projects. So my idea was to clone these projects from local TFS to Git and then use git-tfs rcheckin to push it to our AzureDevOps project.

But when I use "git-fts rcheckin --remote azuretfs" I get "error: latest TFS commit should be parent of commits being checked in"

When I use "git-tfs checin --remote azuretfs" all files are uploaded to the AzureDevOps project but without the history.

So can anyone describe what I have to do?

Note: I don't want to use the MigrationTool offered by Microsoft because of to many erros during validation the templates of work items etc. (we dont use it...)


回答1:


For those who are looking for the same:

With the 'old' git tf tool (https://archive.codeplex.com/?p=gittf) you can migrate old TFVC project to Azure DevOps(TVFC).

If you want to migrate old TFVC projects to AzureDevOps(GIT) you should use git tfs (http://git-tfs.com/)




回答2:


What you could try without guarantee of success...

Note: As I said, you will be able to migrate the history from one branch only.

  1. Create the folder/project in TFVC where you want to put the source code.
  2. Migrate this folder with git tfs clone (to have a git commit with the git-tfs metadata required to rcheckin)
  3. Add the already migrated history repo (let's call it RepoWithHistory) as a local remote in this new repository (let's call it NewRepo). And git fetch
  4. Clean metadata for only the commit coming from RepoWithHistory with something looking like: git filter-branch -f --msg-filter "sed 's/^git-tfs-id:.*$//g'" -- --all. But be careful to keep the metadata on the commits coming from NewRepo.
  5. Use git replace --graft <sha1_of_first_commit_of_RepoWithHistory> <sha1_of_last_commit_of_NewRepo> to graft the 2 histories (the history must be on top of the one from the new one)
  6. Use git rcheckin --no-merge to migrate the history to TFVC (that will be long...)

I hope it will help.

PS: perhaps you should try to do it on a small subset of commits to be able to verify it will works before doing it in the real TFVC project.



来源:https://stackoverflow.com/questions/58609968/clone-git-to-tfs-azuredevops-with-git-tfs

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