do we think of git commits as diffs, snapshots, or histories? https://jvns.ca/blog/2024/01/05/do-we-think-of-git-commits-as-diffs--snapshots--or-histories/
do we think of git commits as diffs, snapshots, or histories? https://jvns.ca/blog/2024/01/05/do-we-think-of-git-commits-as-diffs--snapshots--or-histories/ 16 comments
@b0rk Yes to each of those, depending on the type of project (documentation vs. small programming vs. big programming, the number or other contributors (0 vs. 1 vs. 2+), and the git skill level of the other contributors. @b0rk I do not care how SCM handle commit internally. For me commit is "a change". It may alter content of file, can move it, can have no files even. If I export commit then it is still a valid change which someone can take and apply. Nevermind with it be "git am", "patch", "quilt" or other SCM system than I used. And I like your post. Very detailed and was nice read. @b0rk thanks! As I read your writeup I realized the the ability to rewrite git history is probably simple because commits are snapshots and thus reordering, inserting, and removing them should be fast. @b0rk every so often I run into somebody with (I think) a Mercurial background, which gives them the habit of referring to git commits as 'changesets'. Confusingly, they sometimes do this _even_ in circumstances where they clearly are thinking of the associated source snapshot and not the, well, set of changes. "What changeset did you reproduce this bug with?" @arxanas the point about a "revision" being a snapshot is really good, I've noticed that too. might add that @b0rk Thanks, I liked that! This post woke something in me re the discussion on rebase vs merge the other day. I think I prefer rebase/linear history because it maps very well to a sequence of patch files that could be copied around and applied independent of git itself. Not sure why that feels so "pure" to me, but it does. @b0rk Speaking of this, before git, I worked a lot with monotone, which has quite a lot of similarities to git... however, storage wasn't one of them. Monotone stored commits as diffs, so there were situations where they had to be replayed en masse. That could be quite a performance hit... |
@b0rk Wow I wouldn't think "snapshot" would get so much traction :)
Maybe it's a signpost to where you are in your journey towards #git mastery? :)
Thank you for doing what you do as always!