A tree
basically represents a folder in a traditional filesystem: nested containers for files or other folders.
A tree
contains:
blob
objectstree
objectsJust as you can use ls
or dir
to list the contents of a folder, you can list the contents of a tree
object.
$ git cat-file -p 07b1a631
100644 blob b91bba1b .gitignore
100644 blob cc0956f1 Makefile
040000 tree 92e1ca7e src
...
You can look up the files in a commit
by first finding the hash of the tree
in the commit
, and then looking at that 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
...