为什么git索引文件是二进制的? [英] Why is the git index file binary?
问题描述
我的Git目录中的大部分文件都是纯文本文件(压缩的松散对象和包文件除外)。所以我可以编辑和编辑像 .git / HEAD
或 .git / refs / heads / master
这样的文件并检查如果存储库损坏的话。
但是 .git / index
是一个二进制文件。难道纯文本文件不会更有用,因为它可以很容易地用手修改吗?
Scott Chacon在他的中包含元数据和 Jazimov ,参考文献 em>: 这些数据的连接使其成为一个二进制文件,尽管实际原因是纯粹的推测。 能够通过手动修改它。 Most of the files in my Git directory are plain text files (except for the compressed loose objects and the packfiles). So I can just cat and edit files like But the Scott Chacon shows in his presentation the following image (Slide 278):
In my opinion, this can easily be put to a plain text file. So why is it a binary file rather than a plain text file? The index, as presented in "What does the git index contain EXACTLY?" contains metadata and, as noted below by Jazimov, references: The concatenation of those data makes it a binary file, although the actual reason is pure speculation. Not being able to modify it by hand could by one. 这篇关于为什么git索引文件是二进制的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
.git/HEAD
or .git/refs/heads/master
and inspect the repository if it gets corrupted..git/index
is a binary file. Wouldn't a plain text file be more useful because it can easily be modified by hand?