问题描述
我在使用不区分大小写的文件系统(HFS + [CI])的本地计算机(OS-X 10.10)上进行测试时 - 当我重置为头时:
$ git reset head --hard
$ git reset HEAD --hard
和
$ git checkout 4f2c
$ git checkout 4F2C
具有完全相同的结果。据我了解,GIT存储在 ./git/refs
内部的引用,但底层文件系统的大小写敏感性是否会影响结果?
我会在区分大小写的文件系统上得到相同的结果吗?
是的,它们不区分大小写。不,区分大小写的文件系统无关紧要。由于是的一部分,这些都是十六进制数字(基数为16,它们看起来像字母)。至少对于commit-id。正如在评论中指出的那样, ref-name 可能(或可能不)区分大小写(这取决于底层文件系统以及存储机制是否松动或打包)。
I was testing on my local machine (OS-X 10.10) which uses a case insensitive file system (HFS+ [CI]) - when I reset to the head:
$ git reset head --hard
$ git reset HEAD --hard
and
$ git checkout 4f2c
$ git checkout 4F2C
Have the exact same results. To my understanding GIT stores refs inside ./git/refs
but does the case sensitivity of the underlying file system affect the results?
Would I get the same results on a case sensitive file system?
Yes, they are case insensitive. No, a case sensitive file system will not matter. Because git
refs are part of a SHA-1 hash, and those are hexadecimal digits (base-16, they just look like letters). At least for the commit-id. As pointed out by @EdwardThomson in the comments, a ref-name may (or may not) be case-sensitive (that depends on the underlying filesystem and whether or not the storage mechanism is loose or packed).
这篇关于GIT ref是否总是不区分大小写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!