What happens in this example case?

3 messages, 2 authors, 2016-06-15 · open the first message on its own page

What happens in this example case?

From: Kārlis Repsons <hidden>
Date: 2016-06-15 22:48:34

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?)

Re: What happens in this example case?

From: Eric Raible <hidden>
Date: 2016-06-15 22:48:34

Kārlis Repsons <k <at> 11.lv> writes:
Hi,
it would be good if someone explained how is git doing things internally when:
Hi,
it would be good if someone did basic research before asking such questions.

Start with http://book.git-scm.com.

Re: What happens in this example case?

From: Kārlis Repsons <hidden>
Date: 2016-06-15 22:48:34

On Tuesday 06 April 2010 15:42:05 Eric Raible wrote:
Hi,
it would be good if someone did basic research before asking such
 questions.

Start with http://book.git-scm.com.
Thanks, silly enough I didn't see that link in the documentation page, where 
"Git Community Book : The git-scm.com community-built comprehensive online 
book" was just a headline of some kind to me...

So, as I now understand it: git stores all unique contents of a file into a 
blob; there is no need to descend into the previous commits to get the actual 
contents of a file (as I was admitting, it could happen with help of diffs).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help