Can I stop sync from Git to SVN, and reserve SVN to Git?

I Mirror my remote svn repo to github using

subgit install …

but now I only want to sync changes from SVN to git. how to disable sync changes of Git back to SVN?

Thanks.

Hello,

The subgit install command establishes a mirror between an SVN repository and a Git repository which SubGit has direct access to, it resides on the same machine where SubGit is installed and where it runs. This mirror is essentially two-way and does not support disabling one side of the mirror. As a workaround, it is possible to separate mirrored and non-mirrored Git namespaces so that changes in Git-only namespace are not being sent to SVN automatically, but changes from SVN will require a manual merge in that case.
The local SubGit mirror can also be synchronized with a remote Git server or cloud service, like it’s descried in the following our article:

https://subgit.com/documentation/github.html

but this is customised setup and synchronization between SubGit repository and GitHub is being performed by custom scripts, not by SubGit itself. It’s possible to set it to only gather change from SVN and not send them back, but it all depends on the particular implementation. The article I mentioned describes the steps to gather changes from SVN:

https://subgit.com/documentation/github.html#two_way_mirror_sync

but note, that if it gathers changes that made in SVN to a branch that was changed in GitHub, then it would end up with a conflict and would require a manual resolution and merge.

Got it, Thanks for your reply.
If I create a new branch from git and work on this branch, will the branch auto-sync to SVN?

Hello,

if the branch is pushed to a mirrored SubGit repository and if that branch is covered by the mapping configuration, then yes, it will be synchronised with SVN.

So, what I thought was that if I can create a new branch in git which will be excluded in the mapping configuration file, then at this branch I can do something I don’t want to sync back to SVN.
If so can you tell me what to do in the configuration file?
Thanks

yes, it can be set like this – if a branch is not in the mapping or if it’s excluded with svn.excludeBranches, then it is Git-only branch and changes in that branch are not synchronized. The former can be done just by mapping configuration, there should be no explicit mapping for that branch and/or the wildcard mappings should not cover that particular branch. The latter approach, svn.excludeBranches, is described in details here:

https://subgit.com/documentation/branches-mapping.html#svn_exclude_branches

Hope it will help.

This solution sounds great, one more thing after I change the setting of svn.excludeBranches in subgit/config file, should I run subgit install --rebuild again?

If the branch is present in SVN then yes, it will requires the rebuild.

1 Like