Using the OS X terminal,
How an you view the contents of these files as plain text?
The index is stored under .git/index
.
It is a binary uncompressed format specified at: https://github.com/git/git/blob/master/Documentation/technical/index-format.txt, so the only way to read it is with a tool like hd
.
The index
file contains a list of files with their metadata, including inode, permissions, and modification time. It also contains the SHA-1 of the content, which is stored as an object, which means that when you do git add
it may create new objects.
I encourage you to create a simple test repo like git init init && cd init && echo a > a && git add a
, and then hd .git/index
to verify the format field by field.
The following question focuses more on the index: What does the git index contain EXACTLY?