GIT含糊不清的名字?

编程入门 行业动态 更新时间:2024-10-06 04:10:18
本文介绍了GIT含糊不清的名字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图查看一个名为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

解决方案

通常是因为您的在另一个命名空间中使用了相同的名称(比您的分支):

  • 远程命名空间:远程回购的名称,如 SO问题。(因此davitenio在 git branch -a 中的请求)
  • 或标记命名空间:以分支命名的标记也可以触发该消息(请参阅

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 refspec

When 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含糊不清的名字?

本文发布于:2023-11-26 10:11:16,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不清   名字   GIT

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!