Maxim Suponya
Maxim Suponya

Reputation: 1514

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

Upvotes: 0

Views: 1153

Answers (3)

Maxim Suponya
Maxim Suponya

Reputation: 1514

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.

Upvotes: 0

Mykola Gurov
Mykola Gurov

Reputation: 8685

Since your internal team can work with an external git repo you could make it the mail development repository and dump squashed commits to svn from time to time. This assumes you will not have changes coming from the svn side and will keep it for more technical reasons (deployments/releases). If on the other hand you cannot avoid changes coming from svn side, maintaining the sync with git-svn might quickly become a big task with git-svn and you might want to check the other options suggested by @joran

Upvotes: 0

joran
joran

Reputation: 2883

Git-svn is for a single user that what have an git interface to subversion, collaborating on a git-svn clone will eventually fail (i.e. git-svn uses reabse when fetching updates from subversion and uses current user as author when "pushing" commits back to subversion).

You may resolve the problem with a briding application such as SubGit, SmartGit or https://github.com/mrts/git-svn-bridge

Upvotes: 1

Related Questions