【问题标题】:Git: Unable to determine upstream SVN information from HEAD historyGit:无法从 HEAD 历史记录中确定上游 SVN 信息
【发布时间】:2011-10-08 20:19:37
【问题描述】:

一段时间以来,我已经成功使用 git-svn 连接到我的 svn 主干。我最初通过这样做来设置我的仓库:

git svn clone -s http://domain.com/svn/name-of-repo

我已经设置了很长一段时间(可能接近一年)并且没有遇到任何问题,很可能是因为我所做的一切都在本地 git 分支上,我最终合并回我的主分支,并提交回 svn 主干。

最近,我需要开始将一些更改提交到同一个 svn 存储库中的另一个分支,http://domain.com/svn/name-of-repo/branches/demo

通过编辑我的 .git/config 文件并添加以下行,我能够从该分支获取一次:

[svn-remote "svndemo"]
    url = http://domain.com/svn/name-of-repo/branches/demo
    commiturl = http://domain.com/svn/name-of-repo/branches/demo
    fetch = :refs/remotes/git-svn-demo

然后我运行以下命令来获取演示分支,从修订版 4034 开始:

git svn fetch svndemo -r 4034 

所以现在我有一个名为 remotes/git-svn-demo 的新远程分支。从中我创建了一个功能分支:

git checkout -b svndemo-local remotes/git-svn-demo

这抓住了我需要的东西,所以我做了我必须做的更改,提交到我的本地分支,然后尝试运行“git svn fetch && git svn rebase”。两者都返回错误:

无法从工作树历史中确定上游 SVN 信息

这就是我卡住的地方。我环顾了 SO 和其他网站(Google),但除了“git-svn clone the repo, and start over”之外没有找到解决方案,这并不理想。

我查看了我的 .git/svn/refs/remotes/git-svn-demo/unhandled.log 并将其与我的 .git/svn/refs/remotes/trunk/unhandled.log 进行了比较,但什么也没有他们有很大的不同。

我还查看了从这个远程分支的初始获取中传下来的提交消息,其中包含 git-svn-id 信息。

blah blah blah,这是提交信息,blah blah blah

git-svn-id:http://domain.com/svn/name-of-repo/branches/demo@4034e6edf6fb-f266-4316-afb4-e53d95876a76

我很想听听关于这个的新想法。

【问题讨论】:

    标签: git git-svn


    【解决方案1】:

    要访问 svn 分支,您无需添加新的 svn 遥控器。当您使用 -s(标准)选项设置 git svn clone 后,git 还会跟踪定义在分支下的所有分支。

    您应该能够看到带有git branch -r 的那些分支(在本例中为分支演示)。

    如果你检查了它,你可以在其中工作并 svn dcommit 到它。

    我不确定更改 svn-remote 是否会弄乱您的存储库,但在您的位置上,我会假设它确实如此,并且会使用您原来的克隆命令重新开始。

    【讨论】:

    • 添加 svn-remote 似乎没有做任何积极或消极的事情。此时我可以从远程分支“git checkout -b demo-local remotes/demo”中签出,并且 demo-local 似乎可以跟踪远程分支,但是如果我进行任何变基或合并到那个演示-local 分支,它会再次返回跟踪“远程/中继”。只是令人困惑,因为我不记得这是我以前使用过的工作流程。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-17
    • 1970-01-01
    • 1970-01-01
    • 2020-12-01
    • 2017-01-29
    • 1970-01-01
    相关资源
    最近更新 更多