Hacker News new | ask | show | jobs
by olavfosse 1079 days ago
While it's correct that each Git commit is a snapshot of the worktree, and not a diff, Git uses copy-on-write / structural sharing, which means that generally speaking adding a commit to your repository is a very cheap operation storage wise.

Recommended reading if you're interested in Git's data model, it's pretty easy to understand compared to Git's UI: https://git-scm.com/book/en/v2/Git-Internals-Git-Objects

1 comments

That's my favorite fun fact about git: the diff you see isn't really a diff under the hood, but in fact it kind of is if you look one more layer under.