4 ms·
You are right that this is the model, but if your argument is that this model means that unnecessary disk space is used, that's wrong. https://git-scm.com/book
by adrianmsmith 8y ago
You are right that this is the model, but if your argument is that this model means that unnecessary disk space is used, that's wrong.
https://git-scm.com/book/en/v1/Git-Internals-Packfiles https://git-scm.com/book/en/v1/Git-Internals-Packfiles states, using an example of a file which is 4K and then a new commit which adds a line to that file (thus making the new altered file 4K):
"What is cool is that although the objects on disk before you ran the gc were collectively about 8K in size, the new packfile is only 4K. How does Git do this? When Git packs objects, it looks for files that are named and sized similarly, and stores just the deltas from one version of the file to the next."
You are right that this isn't the thing that's presented to the user as "git diff". The model that Git uses is that each commit has each file at that version, but it uses an optimization (the packfile) to make sure that doesn't take up more disk space than necessary.