Warm tip: This article is reproduced from serverfault.com, please click

其他-合并回购git svn clone与其他git repo

(其他 - Merge repo git svn clone with other git repo)

发布于 2020-12-09 19:44:05

多年来,我的团队一直在使用SVN。几个月前,我们通过简单地推动SVN分支切换到Git,没有任何历史,并且继续在Git上进行开发。今天,我们需要找回SVN历史记录,然后再将其丢失。因此,我使用git svn clone将SVN转换为Git。

因此,我最终得到了一个SVN项目,等效于Git项目(proj_with_history)和一个Git项目,其初始提交与proj_with_history中一个分支的最后提交(proj_without_history)相同。

问题是,在知道已在proj_without_history上创建了新分支和标签的情况下,如何将proj_with_history与proj_without_history链接/合并?

如果可能的话,我们希望使这种迁移在提交的图表中透明,即使重写了历史记录,只要避免冲突即可。

  • proj_with_history:...-f30ab-98ca9
  • proj_without_history:34ac2-h20a5-...
  • 98ca9和34ac2具有相同的代码
Questioner
Alexdu98
Viewed
11
jthill 2020-12-10 04:21:48

将svn克隆与你的git历史记录一起放入存储库中,将该git历史记录的根嫁接到转换后的svn上,提交其内容来自(git replace --graft $theroot $theoriginaltip),本地审核结果,然后使用git filter-branch蛮力来烘烤该嫁接, do-it版本是git filter-branch -- --all --tag-name-filter cat完全放弃旧的历史记录,并使用扩展历史记录的新提示替换它。