使用 Git-Svn 克隆非标准 Svn 存储库

问题描述:

我对 Git 比较陌生,但我发现它在家里很容易使用,所以我想在我们的项目存储在 Svn 存储库中的工作中使用它.不幸的是,存储库有点不标准,我无法克隆它们.当然,它们都有主干、分支/和标签/,但分支/和标签/在进入真实项目目录之前有子目录:

I'm relatively new to Git, but I've found it so easy to work with at home that I'd like to use it at work where our projects are stored in Svn repositories. Unfortunately, the repositories are slightly non-standard and I'm having trouble getting them cloned. Sure, they all have trunk, branches/ and tags/, but branches/ and tags/ have subdirectories before hitting the real project directories:

trunk/
branches/maintenance/release1
branches/maintenance/release2
...
branches/development/feature1
branches/development/feature2
...
tags/build/build1
tags/build/build2
...
tags/release/release1
tags/release/release2

克隆后:

$ git svn clone -s --prefix=svn/ https://mydomain.com/svnproject
$ git branch -r
  development
  development@1340
  maintenance
  maintenance@1340
  tags/build
  tags/build@1340
  tags/release
  tags/release@1340
  trunk
  trunk@1340 

我没有得到任何实际的项目分支或标签.我实际上需要能够在主干、一个维护分支和一个开发分支上工作.除了修改配置的一些技巧外,我还尝试了这种方法,但没有任何效果对我有用.

I get none of the actual project branches or tags. I actually need to be able to work on the trunk, one maintenance branch and one development branch. I've tried this approach in addition to several hacks at modifying the config, but nothing is working for me.

有什么办法可以将我的非标准 Svn 项目的关键组件放到本地 git 存储库中,以便我可以轻松地在它们之间移动?

Is there any way I can get the key components of my non-standard Svn project into a local git repository so that I can easily move between them?

非常感谢.

更新:我应该补充一点,我不能批量切换到 Git(目前).还有其他团队成员参与其中并具有国际影响力.过渡的后勤工作超出了我的意愿,直到我对 Git 更加熟悉为止;正如我所提到的,我还是个新手.我几乎没有触及其功能的皮毛.

Lee B 是对的.doener 在#git 中提供的答案是将 Git 升级到 1.6.x(我一直在使用 1.5.x).1.6.x 提供深度克隆,以便多个通配符可以与 --branches 选项一起使用:

Lee B was right. The answer, provided by doener in #git, is to upgrade Git to 1.6.x (I had been using 1.5.x). 1.6.x offers deep cloning so that multiple wildcards can be used with the --branches option:

$ git svn clone https://svn.myrepos.com/myproject web-self-serve  
          --trunk=trunk --branches=branches/*/* --prefix=svn/
$ git branch -r
  svn/development/sandbox1
  svn/development/feature1
  svn/development/sandbox2
  svn/development/sandbox3
  svn/development/model-associations
  svn/maintenance/version1.0.0
  svn/trunk

正是我需要的.感谢所有的洞察力.

Exactly what I needed. Thanks for the insight, all.