有没有办法“持久地”同步一个Git仓库与SVN?

有没有办法“持久地”同步一个Git仓库与SVN?

问题描述:

从我在网上找到的东西看来,使用 git svn 并不是持久化的。

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

意思是,如果我 git svn clone 存储库,然后推送给master并在独立文件夹,新鲜的副本根本不知道svn,并且无需重新应用 svn clone 。不能用于与SVN同步。

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?

克隆本质上只是初始化一个新的git仓库, origin remote,运行 git fetch ,并根据远程仓库的 HEAD创建一个分支。这些操作中没有一个查看远程仓库中的 .git / svn 信息 - 我认为除了 refs objects HEAD 在远程仓库的git目录中被视为私有。

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.

至于解决这个问题的方法,您可以始终使用 rsync -a scp -r 远程存储库,而不是克隆它,这应该工作 - 所有的Subversion元数据应该被复制。

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.

然而,我个人总是发现它没有混淆,只有一个 git svn 克隆的存储库,我做了 git svn dcommit ,并且每当我想提交任何东西颠覆。然后,这些其他存储库就是普通的git存储库,您不必担心 git svn 的任何限制,直到您推回到 git svn 克隆,此时您通常需要做一些重新绑定......

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...