On Sun, Jun 19, 2016 at 04:20:14PM +0100, Philip Oakley wrote: > From: "Ovatta Bianca" <ovattabianca@xxxxxxxxx> > > I read in every comparison of git vs other version control systems, > > that git does not record differences but takes "snapshots" > > I was wondering what a "snapshot" is ? Does git store at every commit > > the entire files which have been modified even if only a few bytes > > were changed out of a large file? > > > A snaphot is like a tar or zip of all your tracked files. This means it is > easier to determine (compared to lots of diffs) the current content. > > Keeping all the snapshots as separate loose items, when the majority of > their content is unchanged would be very inefficient, so git then uses, at > the right time, an efficient (and obviously lossless) compression technique > to 'zip' all the snapshots together so that the final repository is > 'packed'. The overall effect is a very efficient storage scheme. > > There are some good explanations on the web, such as the > https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain > though you may want to scan from the beginning ;-) I think the delta compression is only half the story. Each commit is a snapshot in that it points to the sha1 of the root tree, which points to the sha1 of other trees and blobs. And following that chain gives you the whole state of the tree, without having to care about other commits. And if the next commit changes only a few files, the sha1 for all the other files will remain unchanged, and git does not need to store them again. So already, before any explicit compression has happened, we get de-duplication of identical content from commit to commit, at the file and tree level. And then when a file does change, we store the whole new version, then delta compress it during "git gc", etc, as you describe. -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html