Git is often described as storing snapshots rather than diffs. What does this mean?
Think about how Git can quickly restore any commit without applying patches.
Git stores a snapshot of the entire project at each commit. It does not save diffs but saves the full state efficiently by reusing unchanged files.
Run git cat-file -p HEAD in a repository. What output do you expect?
HEAD points to the latest commit object.
git cat-file -p HEAD shows the commit object pointed to by HEAD, including metadata and the tree snapshot.
Git stores snapshots for each commit. How does it avoid storing duplicate file data repeatedly?
Think about how Git uses SHA-1 or SHA-256 hashes for objects.
Git uses content-addressable storage. Identical files have the same hash and are stored once, referenced by multiple commits.
You just committed changes, but running git diff shows no output. Why?
Think about what git diff compares by default.
git diff compares the working directory to the index or last commit. After committing, they match, so no diff appears.
Git uses snapshots instead of diffs internally. What is a key advantage of this design?
Think about how Git restores files when switching commits.
Storing snapshots lets Git quickly restore any commit without applying a chain of diffs, improving speed and reliability.