我试图查看一个名为TEAM20-lab2-release的本地分支。当我尝试这样做时,我得到一个模糊的refname错误:
$ git分支TEAM20-lab2-release 警告:refname'TEAM20-lab1-release'不明确。 致命的:模棱两可的对象名称:'TEAM20-lab1-release'。以下是我的分行列表:
$ git branch -a TEAM20-lab1 * TEAM20-lab1-release master remotes / origin / HEAD - > origin / master remotes / origin / master解决方案
通常是因为您的在另一个命名空间中使用了相同的名称(比您的分支):
2016年更新:如果分支和标签共享相同的名称,则Git 2.12(2017年第1季度)不会显示任何错误。
请参阅以丹尼斯提交b284495 (2016年10月31日) Kaarsemaker( seveas )。结果,见提交eef2bda (2016年10月28日)由 JUNIOç滨野( gitster )。 (由 JUNIOç滨野 - gitster - 在 = github/git/git/commit/6c18dd4dc370284417938a252ba7f1a36ad51053 相对= nofollow noreferrer>提交6c18dd4 ,2016年12月27日)
/ code>:不要使用潜在的不明确的默认refspec当用户执行懒惰的 git push ,没有 push.de参数错误设置为上游,简单或 current ,我们在内部生成了一个refspec,它在源端具有当前分支名称并用它来推送。
分支名称(例如 test )可能是中一个不明确的refname,源代码仓库的上下文---可能有一个带有$ b的标签$ b同名,例如。 这会触发一个不必要的错误,而不会在最终用户身上发生任何错误。
一个完整的refname作为源端以避免模糊。 使用 current >推送时的目标端只发送名称并迫使接收端进行猜测,这是同样的问题。 请在此处明确指出。
I'm trying to check out one of my local branches, named TEAM20-lab2-release. When I try to do this, I get an ambiguous refname error:
$ git branch TEAM20-lab2-release warning: refname 'TEAM20-lab1-release' is ambiguous. fatal: Ambiguous object name: 'TEAM20-lab1-release'.Here is the list of my branches:
$ git branch -a TEAM20-lab1 * TEAM20-lab1-release master remotes/origin/HEAD -> origin/master remotes/origin/master解决方案
It usually is because you have the same name (than your branch) used in another namespace:
- like the "remotes" namespace: the name of a remote repo as illustrated by this SO question. (Hence davitenio's request for git branch -a in the comments)
- or the "tags" namespace": having a tag named after a branch can also trigger that message (see this blog post)
Update 2016: Git 2.12 (Q1 2017) won't show any error if a branch and a tag are sharing the same name.
See commit b284495 (31 Oct 2016) by Dennis Kaarsemaker (seveas). See commit eef2bda (28 Oct 2016) by Junio C Hamano (gitster). (Merged by Junio C Hamano -- gitster -- in commit 6c18dd4, 27 Dec 2016)
push: do not use potentially ambiguous default refspecWhen the user does the lazy "git push" with no parameters with push.default set to either "upstream", "simple" or "current", we internally generated a refspec that has the current branch name on the source side and used it to push.
However, the branch name (say "test") may be an ambiguous refname in the context of the source repository --- there may be a tag with the same name, for example. This would trigger an unnecessary error without any fault on the end-user's side.
Be explicit and give a full refname as the source side to avoid the ambiguity. The destination side when pushing with the "current" sent only the name of the branch and forcing the receiving end to guess, which is the same issue. Be explicit there as well.
更多推荐
GIT含糊不清的名字?
发布评论