You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having read the book, I find my understanding of trees still quite fuzzy. It might be helpful to have an entry in the first page glossary describing what they are. Specifically, I wonder:
Do git trees hold anything other than blobs?
If not, how do trees interconnect, as illustrated at the bottom of "The beauty of commits"? Do they inherit their connections from the owning commit?
My understanding is that a commit contains exactly one tree which contains one or more blobs (otherwise the commit would be empty?) If that is the case, then why does the tree pointed to by the first commit in the digram at the bottom of "The beauty of commits" not point to any blobs?
Why are they called trees? The seem to just be buckets of blobs. I see that they can be arranged in a tree, but nothing here demonstrates tree-like behaviour.
The text was updated successfully, but these errors were encountered:
"The beauty of commits" section has everything, but in an abbreviated form. So I think you can find answers in Tree Objects section of ProGit book.
Do git trees hold anything other than blobs?
Not blobs themselves, but refs to blobs and trees.
tree object
An object containing a list of file names and modes along with refs to the associated blob and/or tree objects. A tree is equivalent to a directory.
Do they inherit their connections from the owning commit?
No, the opposite. As you can see in the picture, the arrow points from the commit to the tree. So the commit object refers to the tree object, the tree object refers to other trees and blobs, and trees don't have any information about commits.
My understanding is that a commit contains exactly one tree
If that is the case, then why does the tree pointed to by the first commit in the digram at the bottom of "The beauty of commits" not point to any blobs?
It's directory with subdirectories, without any files, But there are some files in these subdirectories.
Why are they called trees? The seem to just be buckets of blobs. I see that they can be arranged in a tree, but nothing here demonstrates tree-like behaviour.
Because they seem like branches on the tree: they may refer to smaller branches (trees in Git) and/or to leaves (blobs in Git).
You can try all of these things by yourself using plumbing commands, especially cat-file.
Thanks for the great book!
Having read the book, I find my understanding of trees still quite fuzzy. It might be helpful to have an entry in the first page glossary describing what they are. Specifically, I wonder:
The text was updated successfully, but these errors were encountered: