如何克隆一个非标准的svn回购给git? [英] How to clone a nonstandard svn repo to git?

查看:153
本文介绍了如何克隆一个非标准的svn回购给git?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试克隆一个svn repo到git,但是其中一些分支在svn根目录中,如下所示。



我试过了

  $ git clone svn:// url / svn-root -T trunk -b branches -b branch1 -b branch2 

  $ git clone svn:// url / svn-root -T trunk -b branches -b。 

两个都无法克隆 branch1 branch2 正确。请帮助。

  svn-root 
├──分行1
├──分行2
├──分行
│├──分行3
│└──分行4
└──行李箱


解决方案

一个有趣的工具,在:


您应该在分支字段中输入:



  *:refs / heads / *; branches / *:refs / heads / branches / * 
#而不是
branches / *




在这种情况下, branch1 转换为 refs / heads / branch1

branch3 ---至参考文献/头/支链/店3



或者,如果您的顶级分行数量有限,则可以明确列举它们:



  branch1:refs / heads / branch1; 
branch2:refs / heads / branch2;
branches / *:refs / heads / bra nches / *


I try to clone a svn repo to git, but some of the branches are in the svn root dir like follows.

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. 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).
You can know much more about SubGit in "GitMinutes #22: Alexander Kitaev about SubGit".

It is designed to managed unconventional svn repo layout.

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 to refs/heads/branch1,
branch3 --- to refs/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/bra‌​nches/*

这篇关于如何克隆一个非标准的svn回购给git?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆