Comment

Comment by ndand

I used to think commits as snapshots, but it was confusing. Then I read "Git Internals".

A commit contain the "whole" content of each file that we've commited. But since a commit has a pointer to a root commit, it also represents a working directory. Even though a commit contain "whole" files, the git internally stores only parts of the files as an optimization.

When we diff two commits, we see the difference of the file contents in the corresponding working directories that the commits represent.

parent ndand 5 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton