如何解决分支名称和git中的提交哈希之间的歧义? [英] How to resolve ambiguity between branch name and commit hash in git?

查看:68
本文介绍了如何解决分支名称和git中的提交哈希之间的歧义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为0726b的分支,我想将该分支与当前工作副本进行比较. 显然,还有一个提交具有从该序列开始的哈希值,因为我得到了

I have a branch named 0726b and I want to diff my current working copy with that branch. Apparently there is also a commit that has a hash starting with that very sequence, because I get

$ git diff 0726b
warning: refname '0726b' is ambiguous.

如何告诉git应该将参数作为分支名称?

How do I tell git that it should take the argument as a branch name?

推荐答案

尝试一下:

git diff refs/heads/0726b


refs/heads/0726b指定一个名为 0726b 的分支. 文件./git/refs/heads/0726b包含此分支指向的提交哈希.


refs/heads/0726b specifies a branch named 0726b. The file ./git/refs/heads/0726b contains the commit hash that this branch points to.

这篇关于如何解决分支名称和git中的提交哈希之间的歧义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆