问题
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.
- Create the folder/project in TFVC where you want to put the source code.
- Migrate this folder with
git tfs clone
(to have a git commit with the git-tfs metadata required torcheckin
) - Add the already migrated history repo (let's call it
RepoWithHistory
) as a local remote in this new repository (let's call itNewRepo
). Andgit fetch
- 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 fromNewRepo
. - 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) - 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