Skip to content

Commit 3b34f67

Browse files
committed
rn-17: add 'snapshot' article
1 parent 3f5e4c8 commit 3b34f67

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

‎rev_news/drafts/edition-17.md‎

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,50 @@ This edition covers what happened during the month of June 2016.
2525
### Reviews
2626
-->
2727

28-
<!---
2928
### Support
30-
-->
29+
30+
*[Fwd: what is a snapshot](http://thread.gmane.org/gmane.comp.version-control.git/297701/)
31+
32+
Ovatta Bianca asked:
33+
34+
> I read in every comparison of git vs other version control systems,
35+
> that git does not record differences but takes "snapshots"
36+
> I was wondering what a "snapshot" is? Does git store at every commit
37+
> the entire files which have been modified even if only a few bytes
38+
> were changed out of a large file?
39+
40+
Philip Oakley answered:
41+
42+
> A snaphot is like a tar or zip of all your tracked files. This means it is
43+
> easier to determine (compared to lots of diffs) the current content.
44+
>
45+
> Keeping all the snapshots as separate loose items, when the majority of
46+
> their content is unchanged would be very inefficient, so git then uses, at
47+
> the right time, an efficient (and obviously lossless) compression technique
48+
> to 'zip' all the snapshots together so that the final repository is
49+
> 'packed'. The overall effect is a very efficient storage scheme.
50+
51+
and pointed to [some documentation on Git's web site](https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain)
52+
for "some good explanations".
53+
54+
Jeff King alias Peff explained how the relationship between Git
55+
objects already makes things efficient:
56+
57+
> Each commit is a snapshot in that it points to the sha1 of the root
58+
> tree, which points to the sha1 of other trees and blobs. And following
59+
> that chain gives you the whole state of the tree, without having to care
60+
> about other commits.
61+
>
62+
> And if the next commit changes only a few files, the sha1 for all the
63+
> other files will remain unchanged, and git does not need to store them
64+
> again. So already, before any explicit compression has happened, we get
65+
> de-duplication of identical content from commit to commit, at the file
66+
> and tree level.
67+
>
68+
> And then when a file does change, we store the whole new version, then
69+
> delta compress it during "git gc", etc, as you describe.
70+
71+
And Jakub Narębski detailed the "loose" and the "packed" format.
3172

3273
## Releases
3374

0 commit comments

Comments
(0)