如何将连续的 SVN 和 BZR 存储库加入到 GIT 中?

发布于 2024-12-29 01:17:48 字数 275 浏览 3 评论 0原文

我承认这是一个奇怪的请求...

我们有一个项目当前在 Bazaar 中管理,但之前存储在 Subversion 中。然而,之前的开发人员并没有复制历史记录,而是对 SVN 存储库进行了一次导出,并启动了一个全新的 BZR 存储库。

因此,我们有以下内容:

SVN: A-B-C-D
BZR: E-F-G-H

我想要的是:

GIT: A-B-C-D-E-D-G-H

谢谢

A strange request, I admit...

We have a project that is currently managed in Bazaar, but was previously stored in Subversion. However, rather that copying the history across, the previous developers took a single export of the SVN repo and started a brand-new BZR repo.

Thus, we have the following:

SVN: A-B-C-D
BZR: E-F-G-H

And what I want is:

GIT: A-B-C-D-E-D-G-H

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风透绣罗衣 2025-01-05 01:17:48

使用 git filter-branch 可能是最简单的。事实上,这是过滤器分支文档中的示例之一:

将提交(通常位于另一个历史记录的顶端)设置为当前初始提交的父级,以便将其他历史记录粘贴到当前历史记录后面:

       git filter-branch --parent-filter 'sed "s/^\$/-p <graft-id>/"' HEAD

所以这里 是您的提交 D,假设您正在从由 BZR 提交 E 到 H 组成的分支工作。因此,我假设您已使用迁移工具将 svn 和 bzr 历史记录导入 git,并将它们作为单独的分支导入到一个单一的存储库。

Probably easiest with git filter-branch. In fact, this is one of the examples in the filter-branch documentation:

To set a commit (which typically is at the tip of another history) to be the parent of the current initial commit, in order to paste the other history behind the current history:

       git filter-branch --parent-filter 'sed "s/^\$/-p <graft-id>/"' HEAD

So here <graft-id> is your commit D, assuming you are working from a branch consisting of the BZR commits E to H. So I assume you've used migration tools to get both the svn and bzr histories into git, and imported them as separate branches into a single repository.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文