Wil*_*ert 5 git version-control tfs git-tfs
我的任务是将git repo的发布分支镜像到TFS,以便git中的每个提交映射到TFS中的变更集.所有开发人员只提交git和(假设)不知道TFS.
阅读rcheckin的文档以及相关问题的答案让我相信rcheckin能够做到这一点.
git中的所有提交都被压缩成一个变更集.
复制顺序:
git tfs clone http://tfs:8080 $/tfsrepo
cd tfsrepo
git remote add github git@github.com:REPO/Repo.git
git fetch github
git merge github/release
git tfs rcheckin
Run Code Online (Sandbox Code Playgroud)
这导致单个签入TFS,其中包含所有提交.
克隆后,合并来自源(git)repo的第一个提交,rcheckin以创建共享库
git pull github release又git-tfs rcheckin导致再次挤压.对于原始仓库中的前几个提交,我将它们逐个合并到git-tfs共享仓库中并在每个仓库之后进行rcheckin.
我需要做些什么来保持TFS与git-repo的发布分支保持同步,以便git中的每个提交都有相应的TFS变更集?
我确实对这两个repos都有管理控制权,如果有必要,我可以重新设置git repo,这意味着所有后果.我只是不想失去我们已经创建的历史.
我认为您看到的是 git-tfs 仅使用沿 HEAD 和 tfs/default 之间最短路径的提交。TFS 的历史记录是更改列表,而 git 的历史记录是图表,并且您遇到了两者之间的阻抗不匹配。要了解 git-tfs 所看到的情况,请git log --graph --oneline --decorate HEAD tfs/default在使用 rcheckin 之前尝试。
如果你想要 1:1::commit:changeset 的东西,试试这个:
git tfs clone http://tfs:8080 $/tfsrepo
cd tfsrepo
git remote add github git@github.com:REPO/Repo.git
git fetch github
git tfs rcheckin github/release
Run Code Online (Sandbox Code Playgroud)
另一种方法是使用cherry-pick 或rebase。
git tfs clone http://tfs:8080 $/tfsrepo
cd tfsrepo
git remote add github git@github.com:REPO/Repo.git
git fetch github
git checkout -b about-to-be-rewritten-twice github/release
git rebase tfs/default
git tfs rcheckin
Run Code Online (Sandbox Code Playgroud)
查看rebase 文档,了解更多 rebase 功能的示例。
并且不要git push github about-to-be-rewritten-twice:release。
| 归档时间: |
|
| 查看次数: |
2287 次 |
| 最近记录: |