树对象
tree 基本上代表传统文件系统中的文件夹:用于文件或其他文件夹的嵌套容器。
一个 tree 包含:
- 0 个或更多
blob个对象 - 0 个或更多
tree对象
正如你可以使用 ls 或 dir 列出文件夹的内容一样,你可以列出 tree 对象的内容。
$ git cat-file -p 07b1a631
100644 blob b91bba1b .gitignore
100644 blob cc0956f1 Makefile
040000 tree 92e1ca7e src
...
你可以通过首先在 commit 中查找 tree 的哈希值来查找 commit 中的文件,然后查看 tree:
$ git cat-file commit 4bb6f93a
tree 07b1a631
parent ...
author ...
commiter ...
$ git cat-file -p 07b1a631
100644 blob b91bba1b .gitignore
100644 blob cc0956f1 Makefile
040000 tree 92e1ca7e src
...