Live data from Hacker News

Some Git internals

yurichev.com

1–10 of 36 posts

Re: Some Git internals

#2
This was really really educational. Git internals seem rather simple.

Does anyone have a really good visual explanation of what's being done to the tree and such when commits and merges and rebases are done? I still don't quite grok it intimately enough.

Re: Some Git internals

#3

This was really really educational. Git internals seem rather simple. Does anyone have a really good visual explanation of what's being done to the tree and such when commits and merges and rebases are done? I still don't quite grok it intimately enough.

learngitbranching.js.org is quite good

Re: Some Git internals

#4

This was really really educational. Git internals seem rather simple. Does anyone have a really good visual explanation of what's being done to the tree and such when commits and merges and rebases are done? I still don't quite grok it intimately enough.

The Git Internals section of the Pro Git book covers commits [1] and branches [2] well though it doesn’t go into details about merges and rebases.

[1]: https://git-scm.com/book/en/v2/Git-Internals-Git-Objects

[2]: https://git-scm.com/book/en/v2/Git-Internals-Git-References

Re: Some Git internals

#5

This was really really educational. Git internals seem rather simple. Does anyone have a really good visual explanation of what's being done to the tree and such when commits and merges and rebases are done? I still don't quite grok it intimately enough.

Ungit[0] shows what will happen to the tree before you execute a merge or rebase. It really helped me get a hang of Git.

[0] https://github.com/FredrikNoren/ungit

Re: Some Git internals

#6
A dumb question: if I make a commit changing just a single line in a large file, does this create a completely new object/blob with the entire contents of the file? Or does it store it in a more space-efficient manner?

Re: Some Git internals

#8
post #6

A dumb question: if I make a commit changing just a single line in a large file, does this create a completely new object/blob with the entire contents of the file? Or does it store it in a more space-efficient manner?

The former, until you run git gc, in which case the latter happens.

Re: Some Git internals

#9
Nice walkthrough! I did not know about FETCH_HEAD.

Another (complementing) way of getting an idea how Git works is by reading the source of Isomorphic Git[0]. Being in JS and with fewer (as of now) features, it’s a bit more accessible than reference Git.

[0] E.g. https://github.com/isomorphic-git/isomorphic-git/blob/main/s...

Re: Some Git internals

#10
post #8
post #6

A dumb question: if I make a commit changing just a single line in a large file, does this create a completely new object/blob with the entire contents of the file? Or does it store it in a more space-efficient manner?

The former, until you run git gc, in which case the latter happens.

Wow! Running git gc just shrunk my .git folder from 18MB to only 3MB.
Post reply on HN