在 git-svn 项目中使用 git 子模块
在我们的 git-svn 管理的项目中,我们有 3 个上游项目,它们都保存在 GitHub 上的本机 git 存储库中。由于这些上游项目的源代码在我们的控制之下并且经常更改,因此我们当前的解决方案,即每次更改某些内容时都将构建工件重新部署到超级项目是相当麻烦的。
我想要的是这样的:
parent project (git-svn):
--> submodule 1 (git)
--> submodule 2 (git)
--> submodule 3 (git)
这样,子模块 1-3 的源代码与超级项目的源代码一起编译,但我可以单独将更改推送到子模块。
问题是:当我在父项目上执行 git svn dcommit 时会发生什么?这还管用吗?
更新 嗯,我只是设置了一个简单的项目结构,试图模拟这种情况,并且在尝试对超级项目进行 dcommit 时收到此错误消息:
a0301b11f3544a1e71067ff270eded65e4c8afbd doesn't exist in the repository at /opt/local/libexec/git-core/git-svn line 4775
Failed to read object a0301b11f3544a1e71067ff270eded65e4c8afbd at /opt/local/libexec/git-core/git-svn line 574
有任何想法/建议吗?
In our git-svn managed project, we have 3 upstream projects that are all kept in native git repositories on GitHub. Since the source code of those upstream projects is under our control and changes frequently, our current solution, namely re-deploying the build artifacts to the super-project everytime we change something is quite cumbersome.
What I'd like to have is this:
parent project (git-svn):
--> submodule 1 (git)
--> submodule 2 (git)
--> submodule 3 (git)
That way, the source code for submodules 1-3 is compiled along with the sources for the super project, but I can push changes to submodules separately.
The question is: what happens when I git svn dcommit
on the parent project? Does this even work?
UPDATE
Hm, I just set up a simple project structure, trying to resemble this scenario, and I receive this error message when trying to dcommit on the superproject:
a0301b11f3544a1e71067ff270eded65e4c8afbd doesn't exist in the repository at /opt/local/libexec/git-core/git-svn line 4775
Failed to read object a0301b11f3544a1e71067ff270eded65e4c8afbd at /opt/local/libexec/git-core/git-svn line 574
Any ideas/suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你不能这样做,git 子模块不能通过 git-svn 被推送到上游到 svn 存储库,它不支持这一点。
You can't do this, git submodules can't be pushed upstream into a svn repository via git-svn, it doesn't support this.
git-svn 不允许这样做,但如果您有权访问 SVN 存储库服务器,则可以将 SubGit 安装到其中。它将为您创建一个链接的 Git 存储库,这样任何推送到它的操作都会自动转换为 SVN 版本,反之亦然。之后,您可以将子模块添加到生成的 Git 存储库中,并使用纯 Git 界面使用 SVN 存储库。这些 Git 子模块不会被转换为 SVN。
翻译是并发安全且相当透明的(svn:ignores 将被翻译为 Git 忽略,EOL 将被翻译为 .gitattributes,标签将被翻译为标签等)。
git-svn doesn't allow this, but if you have an access to your SVN repository server, you can install SubGit into it. It will created a linked Git repository for you, such that any push to it will be automatically translated to SVN revision and vice versa. After that you can add submodules to the resulting Git repository and work with the SVN repository using pure Git interface. These Git submodules will not be translated to SVN.
The translation is concurrent-safe and rather transparent (svn:ignores will be translated to Git ignores, EOLs to .gitattributes, tags to tags and so on).