我正在开发一个Java遗留项目,该项目有20个模块相互连接。因此,每个模块都有自己的分支和标记。结构是这样的:
/projects
.svn
- module1
.svn
-trunk
-branch
-tag
- module2
.svn
-trunk
-branch
-tag
projects文件夹大约是30 GB,几乎不可能使用git-svn clone
签出所有模块,但这是因为它计算了所有分支和标签。
是否可以只修复项目中继,以便我可以开始在本地提交?
答案 0 :(得分:56)
编辑:我误解了这个问题并回答了我的想法,而不是你实际问过的问题。
克隆单个Subversion目录很简单,实际上克隆哪个目录无关紧要。只是不要指定任何“layout”参数,并直接给出trunk的路径:
git svn clone http://path.to.svn.repo/module1/trunk
“正常”git svn clone
类似于以下内容:
git svn clone --stdlayout http://path.to.svn.repo/
您想要使用的是:
git svn clone --stdlayout http://path.to.svn.repo/module1/
这会找到trunk
文件夹的branch
,tag
和module1
子文件夹,并为您克隆它们。
答案 1 :(得分:13)
我发现使用--stdlayout的git svn clone对我来说做得不对。
在同样的情况下,这种策略运作良好:
git svn init --trunk $repo/projects/module1/trunk --tags $repo/projects/module1/tag --branches $repo/projects/module1/branch git svn fetch
答案 2 :(得分:3)
我只想根据@me_and的答案添加更多信息。
克隆只是trunk的命令会起作用,但在git文件夹中创建的结构是:
refs
|--remotes
|--git-svn
相当于 refs / remotes / git-svn 。
如果我们这样做:
git svn clone https://domain/svn/repo/trunk --no-metadata --authors-file=authors.txt --trunk=https://domain/svn/repo/trunk
然后创建的结构是:
refs
|--remotes
|--origin
|--trunk
相当于 refs / remotes / origin / trunk
第二个结构看起来更友好,可能会减少你必须写的命令和shell脚本:)
P.S。 [--no-metadata]和[--author-file]参数是可选的。