使用 git-svn 重新启用镜像
一段时间以来,我一直将 Subversion 存储库镜像到 Git 存储库。这一直运作良好。但是,由于虚拟服务器崩溃并且没有备份,我必须再次设置镜像。我需要跟踪的存储库有近 1200 个提交,并且包含大量文件(这是使用 Git 镜像的主要原因,因为签出存储库副本的速度要快得多)。
我现在需要做的是让我新克隆的 Git 镜像再次跟踪 Subversion 存储库。我在添加新的远程引用时没有遇到任何问题,但似乎无法弄清楚如何能够再次将 svn 提交拉入 Git 分支。
我似乎收到的一个错误是无法从工作树历史记录中确定上游 SVN 信息
。
如何在仅落后于 Subversion 存储库几次提交的现有 Git 分支上重新启用 Subversion 存储库的镜像?
For some time now I've been mirroring a Subversion repository to a Git repository. Which has always worked fine. However, due to a crash of a virtual server and not having a backup I've got to setup the mirror again. The repository I need to track is almost 1200 commits big and contains a lot of files (which is the main reason for the Git mirror, as it's so much faster to checkout a copy of the repo).
What I need to do now is make my freshly cloned Git mirror make track the Subversion repository again. I've got no problems adding the new remote ref but can't seem to figure out how to be able to pull svn commits into the Git branch again.
One error I seem to receive is Unable to determine upstream SVN information from working tree history
.
How can I re-enable mirroring a Subversion repository on a existing Git branch that's only behind a couple commits from the Subversion repository?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
让它再次工作的最简单方法是从原始目录复制
.git/svn
目录,因为这是跟踪额外的 svn 元数据的地方(假设 git-svn 配置相同) 。但是,由于您没有它,请尝试以下操作:
git svn init http://hostname/svn/repository
与您之前使用过的任何其他参数(也许是-s
?)git checkout
来自 svn 的最新提交。重新创建
git-svn
ref:git update-ref refs/remotes/git-svn HEAD
(或者如果您使用-s
,这应该是refs/remotes/trunk
代替)获取最新版本自当前提交以来来自 svn:
git svn fetch --parent
。这应该为您的整个历史记录重建 git-svn 元数据。The easiest way to get it to work again is to copy over the
.git/svn
directory from the original, as this is where extra svn metadata are tracked (assuming the git-svn config is the same).However, since you don't have it try this:
git svn init http://hostname/svn/repository
with any other parameters you used before (maybe-s
?)git checkout
the latest commit from svn.Recreate the
git-svn
ref:git update-ref refs/remotes/git-svn HEAD
(or if you used-s
, this should berefs/remotes/trunk
instead)Fetch the latest from svn since the current commit:
git svn fetch --parent
. This should rebuild git-svn metadata for your entire history.我在 http://trac.parrot.org/parrot/wiki/ 找到了另一种方法git-svn-教程:
I found another method at http://trac.parrot.org/parrot/wiki/git-svn-tutorial: