How to resolve ambiguity between branch name and commit hash in git?

廉价感情. 提交于 2019-12-05 20:37:15

问题


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.

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


回答1:


Try this:

git diff 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.



来源:https://stackoverflow.com/questions/51534635/how-to-resolve-ambiguity-between-branch-name-and-commit-hash-in-git

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!