6 ms·
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 s
by olavfosse 3y 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 https://git-scm.com/book/en/v2/Git-Internals-Git-Objects
- littlestymaar 3y agoThat'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.