Git 致命的歧义参数 'HEAD' 修订版和文件名都使用 -- 将路径与修订版分开,如 git [....]--[...]

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15106499/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 08:14:33  来源:igfitidea点击:

Git fatal ambiguous argument 'HEAD' both revision and file name use -- to separate paths from revision like git [....]--[...]

git

提问by Srini

  • My git version is 1.8.0 mysysgit0.

  • Remote repo on -linux server.

  • Local repo - Windows 7.

  • 我的 git 版本是 1.8.0 mysysgit0。

  • -linux 服务器上的远程仓库。

  • 本地存储库 - Windows 7。

When I try to commit my local changes it says fatal error below:

当我尝试提交我的本地更改时,它会在下面显示致命错误:

fatal ambiguous argument 'HEAD' both revision and file name use -- to separate paths from revision like  git [....]--[...]

Could any one suggest what is the problem? What is the fix?

任何人都可以提出问题吗?什么是修复?

回答by mvp

You must have file in your repository called HEAD, and this is confusing gitbecause HEADis also customary name for currently active branch.

您的存储库中必须有一个名为 的文件HEAD,这令人困惑,git因为HEAD它也是当前活动分支的惯用名称。

You can use double-dash to remove ambiguity, like this:

您可以使用双破折号来消除歧义,如下所示:

git log -- HEAD

This will show history about file named HEAD.

这将显示有关名为HEAD.

It is probably wise to avoid having files with these special names to avoid these issues.

避免使用具有这些特殊名称的文件以避免这些问题可能是明智的。