Search code examples
svngitgit-svn

Is there a way to "persistently" synchronize a git repository with SVN?


From what I could find around the web, it seems that using git svn is not "persisted".

Meaning, if I git svn clone a repository, then push to master and repull a fresh copy in a separate folder, the fresh copy is not aware of svn at all, and cannot be used to synchronize with SVN without reapplication of svn clone.

Is there a way around this issue?


Solution

  • A clone essentially just initializes a new git repository, sets up the origin remote, runs git fetch, and creates a branch based on the remote repository's HEAD. None of these operations look at the .git/svn information in the remote repository - I think that everything apart from refs, objects and HEAD in a remote repository's git directory is regarded as private.

    As for a way around that, you could always rsync -a or scp -r the remote repository instead of cloning it, which should work - all the Subversion metadata should be copied.

    However, personally I've always found it less confusing to just have one git svn cloned repository that I do git svn dcommit from, and push back to that repository whenever I want to commit anything to Subversion. Then those other repositories are just normal git repositories and you don't need to worry about any of the restrictions of git svn until you push back to the git svn clone, at which point you normally need to do some rebasing...