gpt4 book ai didi

切换分支时 Git 出现歧义警告

转载 作者:行者123 更新时间:2023-12-02 04:25:12 25 4
gpt4 key购买 nike

我收到以下模糊警告,无法切换分支,请帮助我解决此问题

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'.

===>$ gitbranch -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

最佳答案

这是您的问题:

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

关于切换分支时 Git 出现歧义警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27599960/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com