Comment

Comment by hibbelig

> If you think a commit is a diff, you have a mismatch between the mental model and what's actually happening behind the scenes. This will make it difficult to understand concepts later on.

I find that thinking of commits as snapshots is not so useful. I prefer to think of them as a pair of parent commit and diff.

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

It's not clear to me how thinking of commits as snapshots helps me to explain operations such as rebase.

I do concede, however, that "git cat" (I think that's the command) seems more closely related to a snapshot: you identify a commit and a file, and it will give you the content of that file at that commit. Clearly in this case the concept of a snapshot works well. But I need this very rarely.

parent hibbelig 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton