views:

1644

answers:

3

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

After cloning:

$ 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.

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?

Many thanks.

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

After cloning:

$ 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.

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?

Many thanks.

UPDATE: I should add that I can't do a wholesale switch to Git (yet). There are other team members involved and an international presence. The logistics of the transition are more than I'm willing to undertake until I'm much more comfortable with Git; as I mentioned, I'm still pretty new. I've barely scratched the surface of its capabilities.

+3  A: 
VonC
I saw this comment on another post that was similar to my problem. Unfortunately, I don't think that this will work (though I'll definitely take a closer look at svn2git). I need to interact directly with the Svn repos. There are other team members who aren't ready for Git.
Rob Wilkerson
+1 - I had a similar problems when I was learning git, until I set up a new repo using svn2git and the problems went away. A more up-to-date version is available at http://github.com/iteman/svn2git/tree/master.
Paul
A: 

I think you'd get better responses asking this in #git on IRC or on a mailing list.

Lee B
Maybe so, but then you diminish the power of StackOverflow.
phord
+10  A: 

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.

Rob Wilkerson
+1 for the deep cloning option
VonC