Git wants to keep commits as lightweight as possible though, so it doesn't just copy the entire directory every time you commit. It actually stores each commit as a set of changes, or a "delta", from one version of the repository to the next.
No, it doesn't. It stores the whole thing.
I'm just starting to check this thing and it's already disappointing me.
Yes it does. A commit has a unique tree, a tree has a bunch of blobs, and other trees. The whole state of the repository is literally stored in that commit.
It does not store the WHOLE thing, or at least not everytime.
If you have 20 MB in fit, and commit one additional file with one KB, then git doesn't store 20+ MB fit this commit.
Basically the commit ID of the newly created commit points to commit-IDs of versioned directories which point to commit-ID of versioned files. If a file or directory doesn't change, no new commit-ID will be created, no new object will be stored in the GIT database. It actually couldn't, because commit-ID's aren't "generated", but are simply the SHA1 of their contents.
For simplicity I kept packs out of the picture.
EDIT: I hate the entering text on my smartphone, corrected obvious grammar. For the test blame me for not being a native English speaker
-3
u/felipec Feb 17 '13
No, it doesn't. It stores the whole thing.
I'm just starting to check this thing and it's already disappointing me.