[英]How to clone a nonstandard svn repo to git?
I try to clone a svn repo to git, but some of the branches are in the svn root dir like follows. 我尝试将svn repo克隆到git,但是一些分支在svn根目录中,如下所示。
I've tried 我试过了
$ git clone svn://url/svn-root -T trunk -b branches -b branch1 -b branch2
and 和
$ git clone svn://url/svn-root -T trunk -b branches -b .
Both are failed to clone the branch1
and branch2
correctly. 两者都无法正确克隆
branch1
和branch2
。 Please help. 请帮忙。
svn-root
├── branch1
├── branch2
├── branches
│ ├── branch3
│ └── branch4
└── trunk
One interesting tool, mentioned in GitMinutes Episode 20 , is SubGit , a plugin for Atalssian Stash (which isn't free, but you can try it for free). 在GitMinutes第20集中提到的一个有趣的工具是SubGit ,它是Atalssian Stash的插件(它不是免费的,但你可以免费试用)。
You can know much more about SubGit in " GitMinutes #22: Alexander Kitaev about SubGit ". 您可以在“ GitMinutes#22:Alexander Kitaev关于SubGit ”中了解更多有关SubGit的信息 。
It is designed to managed unconventional svn repo layout. 它旨在管理非传统的svn repo布局。
Dmitry Pavlenko comments : 德米特里·帕夫连科 评论道 :
you should enter in the "Branches" field:
你应该进入“分支”字段:
*:refs/heads/*;branches/*:refs/heads/branches/*
# instead of
branches/*
In this case
branch1
will be translated torefs/heads/branch1
,在这种情况下,
branch1
将被转换为refs/heads/branch1
,
branch3
--- torefs/heads/branches/branch3
.branch3
--- torefs/heads/branches/branch3
。Alternatively, if you have limited number of top-level branches, you can enumerate them explicitly:
或者,如果您具有有限数量的顶级分支,则可以显式枚举它们:
branch1:refs/heads/branch1;
branch2:refs/heads/branch2;
branches/*:refs/heads/branches/*
Two options come to mind: 我想到两个选择:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.