svn外部包含一个git分支

时间:2012-07-25 01:42:05

标签: git svn git-svn

我有遗留项目正在使用驻留在git上的子模块。

有很多方法和工具支持从git迁移到git和/或子程序化svn项目,但我需要的恰恰相反。 由于它们是我无法控制的遗留项目,因此我无法将它们迁移到git。 我需要的是每当我在git上推送origin / master时,我希望svn-projects能够在他们“svn up”或“svn co”时自动获取更改

有没有办法实现这个目标?

我尝试过svn:externals但是他们不支持git子模块......任何线索都会受到赞赏。谢谢!

1 个答案:

答案 0 :(得分:1)

作为一种解决方案,我可以建议将SubGit安装到两个存储库中 - 它将为SVN存储库创建一个Git接口,为Git创建一个SVN接口。然后你可以将svn:externals添加到SVN接口的主存储库中,并将子模块添加到其(相同的主存储库)Git,使用SVN的接口和从属存储库的Git接口。

为Git存储库运行安装SubGit:

$ svnadmin create svn.repository

$ subgit configure svn.repository

$ #edit svn.repository/conf/subgit.conf ('git.default.repository' option) 
to set path to your bare Git repository (the repository you on the server)

$ #optionally prepare svn.repository/conf/authors.txt file
to configure custom authors mapping (if you don't like automatic default mapping)

$ subgit install svn.repository

要将SubGit安装到SVN存储库中,请执行相同的步骤,但使用现有的SVN路径而不是svn.repository和git.default.repository的不存在路径(将在此路径中创建Git存储库)。

SubGit将保持每个存储库的两个接口同步,两个接口都是可写的。

希望,这有帮助。