tags:

views:

255

answers:

2

My team develops using Git, making good use of many of its features. We are measurably more efficient at using git that svn.

However our current client want us to deploy code from an svn repository, which means we are required to somehow regularly move our code from git to svn.

At the moment we are maintaining a directory that is both a svn checkout, and a git repo (contains a .git and so on) and we can then do git pull; svn commit

Of course, the process is a bit more complex, as we want to use tags for recording release points, and there is an overhead of running svn add on the files that have been created by git.

What is the best way to do this?

Is git-svn going to help this problem? I have never seen it used other than to allow one individual developer to use git tools locally, when using an SVN repo. I have no idea how well it would work with multiple developers working on multiple branches....

+4  A: 

If one person is deemed the integrator of all code for SVN, and you know no one else is contributing to the SVN repo, you could have him use git-svn to push changes:

  1. Integrator uses his master as a tracking branch for svn (e.g. git svn clone $REPO). He never does work on this branch
  2. Developers work as normal (presumably on topic branches, with a few mainline integration branches)
  3. When you want to do a release, integrator pulls all developer code to his main branch (not master, but something like integration)
  4. Integrator does whatever is needed to ensure release is good to go
  5. Integrator merges integration with his master
  6. Integrator does git svn dcommit

If others are contributing to SVN, you could still do it this way, but the integrator would have to regularly pull from SVN and make those changes available to devs so as to avoid merge conflicts.

At any rate, getting the code into SVN without a lot of hassle is the main issue. You can tag and branch in SVN without a local checkout so the integrator could do tagging (not sure if git svn will send tags to SVN or not)

davetron5000
+1  A: 

davetron5000's answer is probably basically what you want. There's a going to be a trick setting it up, though. If you get your integrator tree set up so that it has a remote for the svn repository and a remote for the original git tree, I suspect git won't recognize them as related. You will probably need to set up a grafts file that explains to git that they have a shared history. Otherwise merges will always have conflicts.

This article looks like it might help in figuring out how to set it up correctly, using git grafts to restore svn merge history.

Otto