“git show HEAD”导致“致命:模棱两可的‘HEAD’:未知修订版或路径不在工作树中”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41194362/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"git show HEAD" results in "fatal : ambiguous 'HEAD': unknown revision or path not in the working tree"
提问by J.G
I'm trying to fix a problem with git
.
我正在尝试解决git
.
When I enter git show HEAD
, I got the error fatal : ambiguous 'HEAD': unknown revision or path not in the working tree
.
当我输入时git show HEAD
,出现错误fatal : ambiguous 'HEAD': unknown revision or path not in the working tree
。
What could I do to fix this problem?
我能做些什么来解决这个问题?
The display of git status
is :
的显示git status
为:
git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: script.txt
Untracked files:
(use "git add <file>..." to include in what will be committed)
script.txt~
回答by jayhendren
There is no HEAD
because you have not yet made any commits to the repository. HEAD
usually points to the currently checked-out commit, but since you have no commits in your tree, HEAD
doesn't point to anything, so git show HEAD
fails.
没有,HEAD
因为您尚未对存储库进行任何提交。 HEAD
通常指向当前签出的提交,但由于您的树中没有提交HEAD
,因此不指向任何内容,因此git show HEAD
失败。