last year I made a one-time migration of our main branch from svn to git with subgit. And subgit did a very good job.
Now, after 6 month, we have the requirement to mirror this git branch back to svn.
This week I tested the options with subgit. I can see 2 posibilities:

  1. use subgit, svnrepo and git bare clone on the same machine and configure subgit in the svn repo with “subgit configure svnrepo”.
    With the right settings in svnrepo\conf\subgit.conf and the command “subgit install svnrepo” the process works.
  2. use subgit and the git bare clone on the same machine, access svn via URL and configure subgit in the git repo with “subgit configure --svn-url URL GITREPO”.
    With the right settings in GITREPO\conf\subgit.conf and the command “subgit install GITREPO” the process works, BUT only if the snvrepo is empty. With an existing branch in svn I get a “unsync” error.

Our svn server is running in an outdated linux environment. Thus i would prefer to run the subgit process and the git bar clone separated from this server. With option 2 above this is possible. Does subgit offer the opportunity to run this process with a non-empty svnrepo and force an initial copy of a git branch to a new (or may be existing) svn branch?

If this is possible we would pay for this service and take an enterprise license for 50-100 users.

Thomas Didszonat

Hello Thomas,

thank you for your interest in our products!

Importing data from Git to SVN is possible, yet depends on how exactly this data is expected to be imported to SVN.

First and the most straight way is to synchronise a Git repository with its source SVN repository: in case if

  • the Git repository was created by importing data from the SVN repository
  • and SubGit metadata has not been wiped out from the repository or changed
  • and commits were made only to the Git side,

then another subgit import or subgit install against the Git repository should detect those repositories are parts of a synchronisation pair and import new Git commits back to SVN. Of course, if any of the above circumstances is not true then this way won’t work.

Another way is the option 2 you mentioned. I’m afraid, though, that this approach only works with an empty SVN repository – otherwise SubGit will decide that this is SVN-to-Git import and move non-matching Git commits to unsynced space. On the other hand, this approach works with any of the supported SVN protocols, so it perfectly possible to perform it running SubGit on a remote computer.

The third way is to embed the branch into a running mirror and thus synchronise it back to SVN: the idea here is to mirror the SVN repository to Git with SubGit mirror (with subgit install) probably setting the minimalRevision to a recent revision to not to import the whole history; then fetch the needed branch from the Git repository in question to the newly created SubGit repository thus migrating the branch into exiting SVN repository.

Hope I managed to answer your question.