樹物件
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
...