Thursday, September 2, 2021
It's all explained here.
Go ahead. Click the link, and read all of it. It's not long.
No?
Ok, then. Here are three of the diagrams from the above link.
Notice how, in the second diagram, different trees can share file objects and
subdirectory (tree) objects, if those files and subdirectories are exactly the
same (test.txt
and d8329f
).
That, to me, is what is so cool about git. It's not bag of diffs. It's an immutable directed graph.
The only thing even resembling diffs in git is the packfile that it will create, as an optimization, when the repository becomes very large or needs to be sent over the network. Even then, it doesn't use diffs per se, but a clever encoding that describes objects as data interspersed with excerpts from other objects.
The next time you're thinking of throwing your laptop out the window out of frustration with git, just stop to think how pretty it is.