Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 在所有平台上是否都不区分大小写?_Git - Fatal编程技术网

Git 在所有平台上是否都不区分大小写?

Git 在所有平台上是否都不区分大小写?,git,Git,在Windows上使用msysgit,我可以执行以下操作: git checkout head 或 两种方法都有效。我没有linux环境可供测试,但我只是好奇:HEAD设计是否不区分大小写?在所有平台上都是这样吗?HEAD在Linux上区分大小写 例如: $ git checkout head error: pathspec 'head' did not match any file(s) known to git. $ git checkout HEAD Your branch is up-

在Windows上使用msysgit,我可以执行以下操作:

git checkout head


两种方法都有效。我没有linux环境可供测试,但我只是好奇:
HEAD
设计是否不区分大小写?在所有平台上都是这样吗?

HEAD
在Linux上区分大小写

例如:

$ git checkout head
error: pathspec 'head' did not match any file(s) known to git.
$ git checkout HEAD
Your branch is up-to-date with 'origin/master'.

Ubuntu 14.04上的Git版本1.9.1。

在Linux环境中,HEAD区分大小写。据我所知,它只在mysysgit中不区分大小写


在Linux环境中,它给出:
错误:pathspec'head'与git已知的任何文件都不匹配。

回答有关Mac OSX的问题(Mavericks):

但是:

顺便说一下,该散列是当前分支的头(在我的测试中,它包含在
.git/refs/heads/master
中)

有趣的行为


(git 1.8.5.2)

HEAD的大小写敏感度取决于操作系统文件系统的大小写敏感度

当您签出HEAD时,git实际上会在文件夹.git下查找名为“HEAD”的文件。如果您用小写字母键入HEAD,git将用小写字母查找文件名。您可以看到.git/HEAD文件实际上包含指向的提交头的哈希代码

因此,HEAD的典型病例敏感性为:

  • Linux上区分大小写
  • Windows、MacOS上不区分大小写

谢谢,简单明了的回答。我确实觉得很不幸,msysgit允许坏习惯的养成(但可能是不区分大小写的一个很好的技术原因)。或者(因为1.8.5 IIRC)使用
@
。MacOS默认不使用不区分大小写的文件系统吗?谢谢Keith,我没有注意到这一点@Lorenzo Marcon,你在Mac操作系统中使用区分大小写的HFS+版本吗?我可以用
git--version
returning
git version 2.20.1(Apple git-117)
在Mojave上重现Lorenzo Marcon的行为,我的文件系统不区分大小写。例如,我可以使用
rma
删除文件
a
。另外,
git push origin HEad
显示为push
HEad
git symbolic ref HEad
git symbolic ref HEad
都返回
refs/heads/foo_branch
git branch HEad
git checkout HEad
,都很有趣,而且
git branch-d HEad
做了一些令人惊讶的正确事情,删除了
HEad
分支,而没有明显破坏我的回购协议。
$ git checkout head
error: pathspec 'head' did not match any file(s) known to git.
$ git checkout HEAD
Your branch is up-to-date with 'origin/master'.
$ git checkout HEAD
Your branch is up-to-date with 'origin/master'.
$ git checkout head
Note: checking out 'head'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at f44b740... fix if endScreen(s) not present