nbeyer nbeyer - 3 months ago 14
Git Question

Is there a way to use git-svn to mirror a Git repo to SVN and have the Git tags/branches become SVN tags/branches?

I've played around with using git-svn to mirror a Git repo to an SVN repo, but I can't seem to do more than push the master changes to the SVN repos trunk.

Essentially what I've done so far is create an SVN repo with the standard layout (project-name/trunk, project-name/tags, project-name/branches) and then do a 'git svn init --stdlayout http://server/svn/project-name'. This sets up git-svn for the current Git repo and then I make any changes I want to in the Git repo and then push those to SVN via 'git svn dcommit', but this only seems to work for the pushing the current branch (usually master) to the SVN project's trunk folder.

What I'd like to be able to do is create Git tags and then push those to the SVN project's tags folder. I'd like to do the same for all of the branches, but that's not required. I need the SVN mirror to have trunk mirror the Git master branch and the tags mirror the Git tags.

Note: the SVN mirror would be read-only

Answer

With git svn alone, you cannot mirror any Git operation back in the SVN. Only new commits done in mirrored branches can be safely dcommit back to SVN.

For a more complete round-trip, you could try git2svn to rebuild a SVN repo.
In the meantime, you can study this git svn workflow, even though tags aren't explicitly mentioned.