Comment

Comment by haberman

> With that in mind, things like rebase become obvious: Take the same diff and attempt to apply it to a different parent.

You can think of it that way if you want. But it's not what Git actually does.

Personally I much prefer to have my mental model match the actual reality of things.

You may not use "git cat" very often, but what about "git checkout <SHA>"? If commits were stored as diffs, then Git would have to rebuild a tree of the very first commit, then replay every single diff up to the SHA you asked for.

What it does in actuality is find the snapshot of that SHA and change the working tree to match it.

parent haberman 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton