git-svn:无法设置跟踪信息; 起点不是分支

Dan*_*aum 22 git git-svn

在git 1.7.9.5中,我可以运行以下行而不会出现错误:

export SVNPASS=readonly
git clone git@github.com:dtenenbaum/RGalaxy.test.git
cd RGalaxy.test/
git config --add svn-remote.hedgehog.url https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/RGalaxy
git config --add svn-remote.hedgehog.fetch :refs/remotes/hedgehog
# the following is a shortcut to avoid fetching every commit since antiquity, since I happen to know the commit number
# where this folder was added to svn:
echo $SVNPASS | git svn fetch --username readonly hedgehog -r 65762:HEAD
git checkout -b local-hedgehog -t hedgehog
Run Code Online (Sandbox Code Playgroud)

在git 1.8.3.4和1.8.4.1中,最后一行导致:

fatal: Cannot setup tracking information; starting point 'hedgehog' is not a branch.
Run Code Online (Sandbox Code Playgroud)

这个问题的评论表明降级,但我想知道为什么会发生这种情况:这是一个错误吗?如果是这样,有报道吗?或者有更好的方法来做到这一点,如果是这样,它是什么?

顺便说一句,"git branch -a"返回:

* master
  remotes/hedgehog
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
Run Code Online (Sandbox Code Playgroud)

Bas*_*ien 34

这不被git-svn开发人员视为错误.事实上,这是v1.8.3.2中的错误修复的结果.设置本地local-hedgehog跟踪git-svn hedgehog将不再有效.

从现在开始,干脆做

git checkout -b hedgehog remotes/hedgehog
Run Code Online (Sandbox Code Playgroud)

足以能够做所有你平时的git - svn的操作(git svn rebase,git svn dcommit,等).

这是Johan Herland的解释:

在v1.8.3.2之前,这仍然有点工作(如下所示),因为代码无法实现远程无效,并且回退到设置branch.feat-bar.remote ="." (即当前的回购).这可能看起来是一种好的做法,直到你意识到返回到无效上游的"git push"会愉快地覆盖refs/remotes /(mirror /)feat-bar,从而打破git-svn的内部状态.

此错误已在v1.8.3.2中修复,更具体地说是41c21f22(branch.c:使用refspec而不是refs/remotes/*验证跟踪分支),您可以在该提交消息中阅读有关该基本原理的更多信息.

最终结果是,升级到> = v1.8.3.2后,将不再接受设置本地专栏以跟踪git-svn的专栏.设置本地专栏分支以在git-svn的专栏上工作的正确方法是放弃上游关系,只需执行"git checkout -b feat-bar refs/remotes /(mirror /)专长-酒吧".

如果你想了解更多细节,我建议你阅读他的全部内容.

  • `git checkout -b remotes/hedgehog`不起作用,对我来说似乎不对.在那种情况下,我得到了一个名为remotes/hedgehog的本地分支,基于当前的HEAD.据我所知,正确的命令是`git checkout -b hedgehog remotes/hedgehog`.这也是约翰解释中使用的命令. (12认同)

Dan*_* W. 5

在SourceTree中,只需删除勾选"本地分支应跟踪远程分支"的复选框.