在不重新下载所有内容的情况下更新git-svn-git-mirror



我使用制作了svn存储库的git镜像

    git svn clone svn://svn.svnrepo.com

我将其上传到github,并能够使用更新本地回购

    git svn rebase svn://svn.svnrepo.com

并将更新推送到github

后来,在我删除了本地副本后,我想再次更新远程

所以我克隆了git-reo

    git clone git://git.gitrepo.com

但当我试图重新调整基准时,我得到了一个错误

    git svn rebase svn://svn.svnrepo.com
    Data from a previous version of git-svn exists, but
    (required for this version (1.8.3.2) of git-svn) does not exist.
    Done migrating from a git-svn v1 layout

然后它给出一个无法从HEAD历史错误中确定上游SVN信息

我试过了:

    git svn init svn://svn.svnrepo.com

带有:

    git svn fetch

但这会启动整个svn回购的重新下载,需要24小时以上当前的svn版本由提交日志中的git-svn-id标记,看起来很好,我如何阻止git-svn从重新获取已经存在的文件中获取,或者在没有整个重新下载的情况下重新建立它的基础?这个镜像从未有过使其与svn上游不同的提交。

只需要运行以下命令

git config svn-remote.svn.url $SVN_URL
git config svn-remote.svn.fetch :refs/remotes/git-svn
svn2git --rebase

或者您也可以手动编辑.git/config以添加svn-remote部分:

[svn-remote "svn"]
    url = SVN_URL
    fetch = :refs/remotes/git-svn

从现在起只有svn2git --rebase

--

PS:归功于我的来源:

  • http://blog.tfnico.com/2010/08/syncing-your-git-repo-with-subversion.html
  • 如何将git存储库与svn存储库重新连接

最新更新