100在git diff命令中意味着什么?我知道这是git文件模式,但请详细介绍此文件模式
新文件模式100644 这 100 在这里。我知道最后三个数字的含义。但不是这个文件模式的意思。请给我所有信息。我喜欢获得全面的信息。
我尝试搜索有关此文件模式的信息,但我只获得有关文件权限的信息,而不是此文件模式的信息。
new file mode 100644
This 100 Here. I Know Last Three Numbers Meaning. But Not This File Mode Means. And Please Give Me All Information About. I Love To Be Fully Informed.
I Tried Searching About This File Mode But I Only Get Information About File Permission, Not This File Mode.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据 git document :
该代码是一系列的位,以八核表示,从最大到最小的
因此您的示例
100644
将二进制转换为001 000 000 000 110 100 100 100
文件类型:1000-常规文件
未使用的位:000
权限:110 100 100-644
,看来树也没有权限的类型代码0100,尽管我看不到文档中指定的类型代码。
According to the git documentation:
The code is a series of bits represented in octodecimal, from largest to smallest
So your example of
100644
translates into binary as001 000 000 110 100 100
file type: 1000 - Regular file
unused bits: 000
permissions: 110 100 100 - 644
It appears that trees also get a type code 0100 with no permissions, though I don't see that specified in the documentation.
Git树对象中的条目只能具有五个不同的“文件模式”。例如,我当前的git源代码包含这些条目:
,这些模式为
100755
100644
,用于执行文件120000
对于符号链接160000
对于子模块,Git的作者可以选择任何文本令牌来识别这五个模式,但是对于历史原因,他们选择将它们写成,就像它们是与
st_mode
在c代码中以八分值表示的st_mode
中相同的值。这种任意选择的证明是值160000
永远不会在struct Stat
中发生(它将是s_ifdir | s_iflnk
行为良好的系统)。An entry in a Git tree object can have only five different "file modes". For example, my current Git source code contains these entries among many others:
The modes are
100644
for a regular file100755
for an executable file040000
for a sub-tree (a directory)120000
for a symbolic link160000
for a submoduleThe writers of Git could have chosen any text tokens to identify these five modes, but for historical reasons, they chose to write them as if they were the same values that would be found in
st_mode
of astruct stat
in C code, written as octal value. Proof of this arbitrary choice is that the value160000
would never occur in astruct stat
(it would beS_IFDIR|S_IFLNK
, an impossibility on a well-behaved system).看来 filemode 是指可执行位(而不是所有权限)
不建议使用 core.fileMode 。它仅寻址模式的可执行位,而不是读/写位。
根据 Git-Config 的文档
It seems filemode refers to the executable bit (and not all permissions)
The use of core.fileMode is not advised. It just addresses the executable bit of mode, not the read/write bits.
As per the documentation of Git-Config