I found this article helpful. This explains the git objects in detail.
Essentially, a blob is just a bunch of bytes that could be anything, like a text file, image, actual source code etc.
A tree is like a directory, it points to:
- blob objects (how a directory points to other files)
- other trees (how a directory can have subdirectories)
tree
/ | \
blob tree blob
|
blob
Hopefully the above example clarifies the difference.
In your example, Podfile
is a file containing source code. Hence, it is a blob
object. However, git is smart and realizes this fact. Hence, when you click the link, it changes the tree
in the link to blob
. You can try and test this yourself by clicking the below tree
link:
https://github.com/facebook/pop/tree/master/Podfile
Similary, if you go to a directory on a git repository it is a tree
object. Again, if you change the tree
to blob
git is smart and realizes that it is actually a directory and not a file and changes the blob
in the link to tree
. Again, you can try and test this yourself:
https://github.com/facebook/pop/blob/master/pop-tests
In terms of which link to prefer when you want to add to a document, it depends on what does the link point to. Essentially, there are 4 types of git objects:
- blob - file
- tree - directory
- commit - reference to tree
- tag - reference to commit
Hope that answers your question. I still recommend going through the article to get a thorough understanding of git objects.