我收到以下不明确警告但无法切换分支,请帮我解决此问题
maradhak@WW720L102019A /c/myProj (mylocalbranch1)
$ git checkout -b mylocalbranch2 origin/sprint_20_master
warning: refname 'origin/sprint_20_master' is ambiguous.
Checking out files: 100% (535/535), done.
warning: refname 'origin/sprint_20_master' is ambiguous.
fatal: Ambiguous object name: 'origin/sprint_20_master'.
===> $ git branch -a,请找到下面的输出
master
* mylocalbranch1
origin/sprint_20_master
sampleapp
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/sampleapp
remotes/origin/sprint20_jothi
remotes/origin/sprint20mani
remotes/origin/sprint_20_master
maradhak@WW720L102019A /c/myProj (mylocalbranch1)
===> $ git ls-remote。请找到下面的输出
37aaf00bf238cc520307bfc51c2148f95908e086 HEAD
e42e61debb97f8dad54e3f825d9dd2fe44afef52 refs/heads/master
37aaf00bf238cc520307bfc51c2148f95908e086 refs/heads/mylocalbranch1
f346e6260f4c0166883e7dfba927f069d74a2c31 refs/heads/origin/sprint_20_master
f346e6260f4c0166883e7dfba927f069d74a2c31 refs/heads/sampleapp
e42e61debb97f8dad54e3f825d9dd2fe44afef52 refs/remotes/origin/HEAD
e42e61debb97f8dad54e3f825d9dd2fe44afef52 refs/remotes/origin/master
f346e6260f4c0166883e7dfba927f069d74a2c31 refs/remotes/origin/sampleapp
fb4faac845d7955b99e5345bad2c86c2f7187810 refs/remotes/origin/sprint20_jothi
37aaf00bf238cc520307bfc51c2148f95908e086 refs/remotes/origin/sprint20mani
36a77aeeef61ce744455f2406427d2e2ceb774ba refs/remotes/origin/sprint_20_master
maradhak@WW720L102019A /c/myProj (mylocalbranch1)
===> $ git show-ref,请找到下面的输出
e42e61debb97f8dad54e3f825d9dd2fe44afef52 refs/heads/master
37aaf00bf238cc520307bfc51c2148f95908e086 refs/heads/mylocalbranch1
f346e6260f4c0166883e7dfba927f069d74a2c31 refs/heads/origin/sprint_20_master
f346e6260f4c0166883e7dfba927f069d74a2c31 refs/heads/sampleapp
e42e61debb97f8dad54e3f825d9dd2fe44afef52 refs/remotes/origin/HEAD
e42e61debb97f8dad54e3f825d9dd2fe44afef52 refs/remotes/origin/master
f346e6260f4c0166883e7dfba927f069d74a2c31 refs/remotes/origin/sampleapp
fb4faac845d7955b99e5345bad2c86c2f7187810 refs/remotes/origin/sprint20_jothi
37aaf00bf238cc520307bfc51c2148f95908e086 refs/remotes/origin/sprint20mani
36a77aeeef61ce744455f2406427d2e2ceb774ba refs/remotes/origin/sprint_20_master
答案 0 :(得分:4)
这是你的问题:
f346e6260f4c0166883e7dfba927f069d74a2c31 refs/heads/origin/sprint_20_master
36a77aeeef61ce744455f2406427d2e2ceb774ba refs/remotes/origin/sprint_20_master
您设法构建了一个名为origin/sprint_20_master
的本地分支,并且还拥有属于该远程的分支。 Git无法区分您想要使用哪一个作为新分支的基础。我假设你不想要本地版本。您可以使用以下命令将其删除:
git update-ref -m "remove ambiguous ref" -d refs/heads/origin/sprint_20_master