[英]How to use git-svn to checkout only trunk and not branches and tags?
I'm working on a Java legacy project which has 20 modules connected to each other. 我正在开发一个Java遗留项目,它有20个模块相互连接。 So, each module has it's own branch and tag.
因此,每个模块都有自己的分支和标记。 The structure is like this:
结构是这样的:
/projects
.svn
- module1
.svn
-trunk
-branch
-tag
- module2
.svn
-trunk
-branch
-tag
The projects folder is around 30 GB which is nearly impossible to use git-svn clone
to checkout all the modules, but it's because it counts all the branches and tags. projects文件夹大约是30 GB,几乎不可能使用
git-svn clone
来检查所有模块,但这是因为它计算所有分支和标签。
Is it possible to just clone the project only trunk so I can start committing locally? 是否可以只克隆项目中继,以便我可以开始在本地提交?
Edit : I misread the question and answered what I thought you were asking, not what you actually asked. 编辑 :我误解了这个问题并回答了我的想法,而不是你实际问的问题。
Cloning a single Subversion directory is easy, and it actually doesn't matter which directory you clone. 克隆单个Subversion目录很简单,实际上克隆哪个目录无关紧要。 Just don't specify any of the "layout" arguments, and give the path to the trunk directly:
只是不要指定任何“layout”参数,并直接给出trunk的路径:
git svn clone http://path.to.svn.repo/module1/trunk
A "normal" git svn clone
would look something like the following: 一个“正常”的
git svn clone
看起来像下面这样:
git svn clone --stdlayout http://path.to.svn.repo/
What you want to use instead will be thus: 因此,你想要使用的是:
git svn clone --stdlayout http://path.to.svn.repo/module1/
That will find the trunk
, branch
and tag
subfolders of the module1
folder, and clone them for you. 这将找到
module1
文件夹的trunk
, branch
和tag
子文件夹,并为您克隆它们。
I have found git svn clone with --stdlayout didn't do quite the right thing for me. 我发现使用--stdlayout的git svn clone并没有为我做正确的事情。
In the same situation this strategy worked well: 在同样的情况下,这种策略运作良好:
git svn init --trunk $repo/projects/module1/trunk --tags $repo/projects/module1/tag --branches $repo/projects/module1/branch git svn fetch
I just wanted to add more information based on @me_and's answer. 我只想根据@me_and的答案添加更多信息。
the command given to clone just trunk is gonna work but in the git folder the structure created was: 克隆只是trunk的命令会起作用,但在git文件夹中创建的结构是:
refs
|--remotes
|--git-svn
which is equivalent of refs/remotes/git-svn . 这相当于refs / remotes / git-svn 。
if we do this instead: 如果我们这样做:
git svn clone https://domain/svn/repo/trunk --no-metadata --authors-file=authors.txt --trunk=https://domain/svn/repo/trunk
then the structure created is: 然后创建的结构是:
refs
|--remotes
|--origin
|--trunk
which is equivalent to refs/remotes/origin/trunk 这相当于refs / remotes / origin / trunk
The second structure looks more git-friendly and potentially could reduce the commands and shell scripts you have to write :) 第二个结构看起来更友好,可能会减少你必须编写的命令和shell脚本:)
PS the [--no-metadata] and [--author-file] arguments are optional. PS [--no-metadata]和[--author-file]参数是可选的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.