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

Re: Some problems for git beginners

From
Philip Oakley <philipoakley@iee.email>
Date
Oct 9, 2021, 10:32 UTC
Message-ID
<4ef81a4e-e832-1968-3f31-5f15cd0c7320@iee.email>
In-Reply-To
<ffe633c5-151a-8646-20ef-be4f50c5f59e@gmail.com>
On 09/10/2021 10:12, Bagas Sanjaya wrote:
Show 13 quoted lines
> On 09/10/21 14.43, ZhangJinbao wrote:
>
>> Third, when a commit event occurs, the current blob file stores the
>> full amount of data, while the previous version stores the
>> incremental data
>>
>
> When you `git commit`, Git will initially write objects related to the
> commit (blob, tree, and commit) as loose objects. Some point on the
> time, Git will repack many loose objects into one big packfile and
> write the corresponding pack index. Delta compression is applied when
> writing the packfile.
>

Git is multi-layered, and multi-faceted. So often the impression given isn't the same as what happens internally.

All commits are full snapshots, even if git (normally) shows only the changes for previous diffs.

But then git will, at a convenient point 'pack' all those snapshots (fairly efficiently) so that the local git storage of the whole repository, with full history, (typically) is no bigger than the checked out files. The packing is part of that layering.

There are similar facet/layer effects from the Staging area ("index") / Object store viewpoints.

The https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain is worth a read, along with other descriptions.

Philip
Previous: Bagas SanjayaNext: Philip Oakley
Message 3 of 4 in “Some problems for git beginners”
  1. ZhangJinbaoOct 9, 2021
  2. Bagas SanjayaOct 9, 2021
  3. Philip OakleyOct 9, 2021
  4. Philip OakleyOct 11, 2021

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.