Reputation: 5821
I have a primary git repository for an opensource project
I want to mirror all commits to a svn repository (on code.google.com), is it possible ?
Upvotes: 9
Views: 2074
Reputation: 2999
I doubt that's possible with code.google.com, but you can setup your own Subversion repository and install SubGit into it.
As soon as installation is completed you have a linked pair of Subversion and Git repositories. Every modification in any repository triggers a SubGit hook that automatically converts all the necessary changes.
For more information please refer to documentation and git-svn comparison.
SubGit is a commercial product, but for open-source projects you can get a free license.
Upvotes: 1
Reputation: 121
I've faced this situation in my present job. Our primary Git repository has non-linear history so selected solution should handle this. Solution that seems to work so far is based around gitsvn proxy repository. I have a post-receive hook installed in primary Git repository that at it's core has something like this:
export GIT_DIR=$GITSVN_PROXY_DIR/.git
git pull -Xtheirs file://$GIT_PRIMARY_DIR master
git svn dcommit
After dcommit log history is rewritten. On the next git pull from primary Git repository you'd normally get mrege conflicts. This is where -Xtheirs option kicks in. It's an merging strategy favoring remote version of changes. In this case it allows us to resolve conflicts automatically! :)
Only disadvantage: pretty SVN commit messages do not come for free. Some git hacking is required to make them contain all the info from primary Git commit messages.
Upvotes: 3
Reputation: 16439
If your git history is linear, you could try using git-svn. I would try using "git svn clone" to import the existing (empty) SVN repository into git, then rebase your existing git history onto that and "git svn dcommit" it.
If your git history isn't linear (contains branches and merges), you won't be able to properly represent it in SVN. In that case, I strongly suggest you use a git-based hosting solution instead (e.g. github.com).
Upvotes: 3
Reputation: 18292
Yes, that is possible. Use Git's SVN features to import into a repository. You can then push back from there. You'll find that for the most part, though, that git can effectively show an SVN history better than SVN can show a git history.
Upvotes: 4
Reputation: 96
Have you checked out http://git-scm.com/docs/git-svn I don't know if this will solve your problem or not, but it is a way to sync git and svn.
-CJ
Upvotes: 0