将多个svn项目合并到一个git存储库中? [英] Multiple svn projects into one git repository?
问题描述
我已经开始在某些工作中使用git-svn来进行本地提交.这对于使用标准svn布局的项目非常有用.最近,我开始从事一个Java项目,该项目分为多个连接的模块(20-25),每个模块在同一svn存储库中都有自己的根文件夹,并带有自己的trunk/branchs/tags.
I have started to use git-svn for some of my work to be able to do local commits. This works great for projects that use standard svn layout. Recently I started working on a Java project that is split into multiple connected modules (20-25), and each module have its own root folder in the same svn repo with its own trunk/branches/tags.
svnrepo/
module-1
trunk
branches
tags
module-N
trunk
branches
tags
我已经使用git svn clone -s/path/to/svnrepo/module [1-N]克隆了每个模块. 问题"是,当我想在所有模块上执行git svn rebase时,我必须做N次.
I have cloned each and every module with git svn clone -s /path/to/svnrepo/module[1-N]. The "problem" is that when I want to do git svn rebase on all modules i have to do it N times.
我试图做git svn clone/path/to/svnrepo/避免重复执行N次操作,但这使我的目录布局与svn repo中的相同.
I have tried to do git svn clone /path/to/svnrepo/ do avoid doing the rebase operation N times, but that leaves me with a directory layout that is the same as in the svn repo.
有没有一种方法可以在一个git repo中跟踪所有模块的所有干线?这样我就可以在git存储库中得到这样的目录布局:
Is there a way that I can track all the trunks of all modules in one git repo? So that I get a directory layout like this within my git repository:
module-1
module-2
module-N
推荐答案
不幸的是,没有,没有办法做到这一点.一个问题是,没有什么可以阻止两个或多个模块具有相同名称的分支.然后,在git-svn中,当您为其指定分支名称时,它将如何知道您在谈论哪个模块?
Unfortunately, no, there is no way to do this. One problem is that there is nothing preventing two or more modules from having a branch with the same name. Then, in git-svn, when you give it the branch name, how would it know which module you are talking about?
这个问题确实源于以下事实:在Subversion中,分支不是一流的概念,而在git中,分支是一流的概念. git-svn能够或多或少地使用kludge来解决这个问题,但是如果回购协议具有非标准"布局(例如您正在使用的布局),则kludge会崩溃.
This problem really stems from the fact that in Subversion branches are not a first-class concept, whereas in git they are. git-svn is able to use more-or-less a kludge to work around this fact, but the kludge breaks down if the repo has a "non-standard" layout (such as the one you are working with).
我的建议:为所有脚本git-svn rebase
编写脚本.
My suggestion: write a script to git-svn rebase
them all.
这篇关于将多个svn项目合并到一个git存储库中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!