git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Fwd: what is a snapshot?

From
Jakub Narębski <jnareb@gmail.com>
Date
Jun 29, 2016, 19:28 UTC
Message-ID
<57742174.9020309@gmail.com>
In-Reply-To
<CAHWPVgMWeHoD5vTiFJ1gsm2hS74LK7j4npVVbOZeR43cX3qWXw@mail.gmail.com>
W dniu 2016-06-19 o 16:15, Ovatta Bianca pisze:
Show 5 quoted lines
> 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?

There are two things: the conceptual level, and actual storage. On the conceptual level, object representing revisions (commit) refer to object representing top directory (tree) of a project, that is a snapshot of a project state at given revision.

On the storage level, Git has two types of object storage. In "loose" format (used for new objects), each object is stored as a separate file. This is not as wasteful as you think: first, there is deduplication, that is each version of a file is stored only once. Second, contents (usually text) is stored compressed.

In "packed" format (nowadays Git automatically repacks from "loose" to "packed" when it looks like it is needed) there is additional libxdiff-like deltafication. In this format Git stores differences (well, it also ensures that delta chain doesn't gets too long).

HTH
-- 
Jakub Narębski
Previous: Jeff King
Message 4 of 4 in “Fwd: what is a snapshot?”
  1. Ovatta BiancaJun 19, 2016
  2. Philip OakleyJun 19, 2016
  3. Jeff KingJun 24, 2016
  4. Jakub NarębskiJun 29, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.