Search code examples
gitsvnversion-controlgit-svn

bridging svn and git repos


We've got two teams: internal team in the office behind a proxy using internal svn; external team out in the open internet using git and wanting to collaborate but not being able to access the internal svn. Internal team must remain on svn, office network can't allow external access.

The question: how can the office team relay their svn changes to external team's git repo and back from git repo into svn?

In the office we were quite successfully been using git svn so that all local development is on git with fetching and dcommitting from/to svn. But we can't quite figure out how to link a remote repo so we could do something like:

git checkout gitmaster
git merge svntrunk
git push
git checkout svntrunk
git svn fetch
git merge gitmaster
git svn dcommit

Solution

  • So here's what I've settled with and successfully used over the past 2 weeks:

    1. Cloned svn trunk with git svn. This created master and a branch called git-svn.
    2. Created branch git-trunk off master and copied the repository to a remote git host.
    3. Added the remote as my-git-remote.
    4. Set git-trunk as upstream with git branch --set-upstream-to my-git-remote.

    Now to sync svn trunk into git-trunk i do:

     git svn fetch
     git checkout git-trunk
     git merge git-svn
     git push
    

    And to sync git-trunk to svn trunk i do:

     git checkout git-trunk
     git svn dcommit
    

    Works fine so far. External team works on git-trunk and doesn't worry about subversion, internal team works on subversion as usual and has no clue that some commits come from git. And i just need to remember to sync changes every now and then.

    I do realize now that creating git-trunk branch was probably redundant, could just merge git-svn to master and dcommit master.