
Some developer thinks Git stores the line-by-line differences between commits. It doesn't work that way. When you run git commit, git records a snapshot of your staged project. changed files become new objects, identified by hashes and stored in Git's object database. files that haven't changed reuse their existing objects. And when you run git diff, Git compares the snapshots to work out what changed. The interesting part is that Git can later compress similar objects into deltas inside packfiles to save space. Git tracks snapshots. diffs are something it can calculate from them.










