Synchronizing remote SVN with remote Git

If there are two remote repositories and there’s no filesystem level access to any of them two, besides other things it means that there’s no access for SubGit to their hooks. That means that those two repositories always accept commits, there’s no way to change that behaviour and to build in some consistency check.

By default in a normal situation SubGit would try to apply Git changes to SVN before accepting the changes in Git. If the SVN update didn’t work SubGit would reject the whole Git push either. So in case of two remote repositories the main problem is that it’s not possible to reject anything that comes there. Subsequently that means it’s very possible a situation when at the same time somebody would separatedly commit to Git and SVN at the same time and commits would get accepted.

Those changes could create an ambigous situation when trying to synchronize because it would be not obvious which changes should be applied first, and if there is a direct conflict system wouldn’t know how to resolve it at all. For example if in SVN the file is changed and in Git the same file is deleted, how SubGit would decide which way to proceed? So SubGit doesn’t take a responsibility to deal with that situation. We consider it theoretically impossible to reliably synchronize 2 remote repositories, so SubGit doesn’t do that in a straightforwad way.

But when one’s not afraid of manual conflict resolving, there is a trick that would allow a user to synchronize two remote repositories with a bit of scripting and risks taking. To find out how check out that article of ours.

This description is not specific only for GitHib, this solution would work for any remote repositories synchronisation. But one should bear in mind that when using ‘working tree’ method, simultaneous conflicting changes would still bring up an issue, for example the script would send to an user an email about merge conflict and impossibility of auto-synchronisation, and the contents of two remote repositories would remain unsynchronized.

Written on December 18, 2016