There is any way to synchronize GIT and Subversion repositories?

27,440

Solution 1

The best way to do this is to use git svn as a Subversion client. This provides two-way integration between a Subversion repository and a Git repository. Once you have a Git repository, you can push that anywhere else to publish it.

I do this regularly, at work there is a Subversion repository that is the "master" repository, and I usually use git svn to access it. Sometimes if I'm doing things that need more specific Subversion functionality like merging, I'll use the regular svn client against the repository instead.

Solution 2

There's a new solution that performs exactly what you want --- SubGit. It is concurrent-safe (I can't say the same about git-svn-based bash scripts).

Solution 3

Our team had exactly the same problem and after a bit of experimentation we managed to come up with a git-Subversion bridge that synchronizes changes between our team git repository and the corporate Subversion repository. Our git usage is transparent to other Subversion users.

The setup is described in more detail at https://github.com/mrts/git-svn-bridge.

We have used this setup in production for more than a year.

I guess the biggest caveat of the setup is that the git repository tracks only SVN trunk (or another single branch), thus other git branches will be squashed into one commit during merge to trunk. For us this is no problem - we use short-lived task branches and consider them to be lightweight, ephemeral "units of work" that can go to mainline in a single chunk - and the branch history is retained in git.

Solution 4

You might consider svn2git to easily import svn to git, and then its mirror ruby application git2svn.
More details in this question.
As mentioned in the other answers, 'git svn' is mandatory, but those ruby modules help you respect the "subversion branches/directory" while not having them as an actual directory in Git.

Solution 5

You might also want to check out this solution: http://unethicalblogger.com/posts/2008/10/git_back_subversion_mostly_automagically_part_33 , which was used to synchronize a repo between git and subversion, with multiple developers using both git and subversion, and a proxy between them to do the synchronization.

Share:
27,440
Jader Dias
Author by

Jader Dias

Perl, Javascript, C#, Go, Matlab and Python Developer

Updated on July 16, 2022

Comments

  • Jader Dias
    Jader Dias almost 2 years

    I want to access a repository using both GIT and SVN clients. A way I imagined to do that is through automatic two-way migration: when a user PUSHes into the GIT repository, it is also COMMITed in the SVN repository and vice-versa.

    There is any tool that would help me to do that?