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

What happens in this example case?

From
KRKārlis Repsons <k@11.lv>
Date
Apr 6, 2010, 09:13 UTC
Message-ID
<201004060913.56760.k@11.lv>

Hi, it would be good if someone explained how is git doing things internally when:

1. mkdir dir; cd dir; git init; echo -e "A\na\nA" > file; git add .; git commit -a -m comm1

2. echo -e "A\nb\nA" > file; git commit -a -m comm2;

I want to understand how those three letters are stored in each of the two cases and how can the contents of file be recovered from .git archive, say, after git reset --hard <commit-hash>?

(is git storing just the position of change for 'b' and 'b' in the second case? why is $(git cat-file -p) showing all three letters for the respective objects in both cases?)

Next: Eric Raible
Message 1 of 3 in “What happens in this example case?”
  1. Kārlis RepsonsApr 6, 2010
  2. Eric RaibleApr 6, 2010
  3. Kārlis RepsonsApr 6, 2010

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.