3 ms·
From https://git-scm.com/book/en/v2/Git-Internals-Packfiles https://git-scm.com/book/en/v2/Git-Internals-Packfiles : > You have two nearly identical 22K object
by MaxBarraclough 4y ago
From https://git-scm.com/book/en/v2/Git-Internals-Packfiles https://git-scm.com/book/en/v2/Git-Internals-Packfiles :
> You have two nearly identical 22K objects on your disk (each compressed to approximately 7K). Wouldn’t it be nice if Git could store one of them in full but then the second object only as the delta between it and the first?
> It turns out that it can. The initial format in which Git saves objects on disk is called a “loose” object format. However, occasionally Git packs up several of these objects into a single binary file called a “packfile” in order to save space and be more efficient.
...
> What is also interesting is that the second version of the file is the one that is stored intact, whereas the original version is stored as a delta — this is because you’re most likely to need faster access to the most recent version of the file.
- masklinn 4y agoThat is what's covered by the article, but as various commenters have noted it's not part of git's model, it's an optimisation of git's storage. So thinking in those terms for modelling / visualising git's behaviour is nonsensical.
- MaxBarraclough 4y agoIt's not hard to make correct statements about the git user interface without being misleading about its internals. josephg said: > Each different version of every file is stored in full. which is an untrue statement about how git internally manages its data. It would be fine had they instead said: > From the user's point of view, it's as if each different version of every file is stored in full. Internally, git may perform compression, including differential compression. This isn't the first time I've seen this confusion. This 2014 StackOverflow thread [0] does the same, as does an old HN thread. [1] The solution is clear communication. [0] https://stackoverflow.com/q/8198105/ https://stackoverflow.com/q/8198105/ [1] https://news.ycombinator.com/item?id=25459757 https://news.ycombinator.com/item?id=25459757