git clone of git-svn tree? git clone of git-svn tree? git git

git clone of git-svn tree?


I have a bridge setup for some of my projects, but it's only one-way from git to svn (providing a public readonly SVN mirror of our git master branch). However, since it works fine it might help you or point you in the right direction in your two-way scenario anyway, as I assume it's git->svn that makes problems, not svn->git:

My one-way scenario: Existing git repository at github, need a readonly svn mirror of the git master branch

  • Create and initialize the target subversion repository on the Server:

    svnadmin create svnrepomkdir trunksvn import trunk svn://yoursvnserver/svnrepormdir -rf trunk
  • Create a mixed Git-Svn checkout and initialize subversion repository

    git svn clone svn://yoursvnserver/svnrepo/trunkcd trunkgit remote add github git://github.com/yourname/repo.gitgit fetch githubgit branch tmp $(cat .git/refs/remotes/github/master)git tag -a -m "Last fetch" last tmpINIT_COMMIT=$(git log tmp --pretty=format:%H | tail -1)git checkout $INIT_COMMIT .git commit -C $INIT_COMMITgit rebase master tmpgit branch -M tmp mastergit svn dcommit --rmdir --find-copies-harder
  • Update the mirror

    git fetch githubgit branch tmp $(cat .git/refs/remotes/github/master)git tag -a -m "Last fetch" newlast tmpgit rebase --onto master last tmpgit branch -M tmp mastergit svn dcommit --rmdir --find-copies-hardermv .git/refs/tags/newlast .git/refs/tags/last

This two articles from googlecode might help as well:


One thing that may be causing you trouble is that git svn dcommit will rewrite all the commits it sends to SVN- at least if it's configured to add the SVN metadata note to the bottom of the commit messages. So you will have to adopt a flow where any repositories taking commits from your git-svn workspace rebase against it, losing all the merge history which can't be stored in SVN anyway.


Based on what I've seen, this workflow isn't supported with git-svn, and won't be, due to the way SVN represents merges.