4 ms·
"history vs snapshot" is a kind of weird distinction that could use some pulling apart. A commit is a snapshot, but that snapshot includes a reference to prior
by o11c 3y ago
"history vs snapshot" is a kind of weird distinction that could use some pulling apart.
A commit is a snapshot, but that snapshot includes a reference to prior history. It "isn't" the history per se, but includes a way to get it. When we `git log` it's clearly thinking in terms of a sequence of commits, not a single commit with multiple snapshots.
A commit is not a full history; a lot of stuff is only in the reflog, and the reflog isn't permanent. Losing the branch name is a big deal but there are no good solutions and mercurial's attempt is definitely worse (flashbacks of `svn rename`, which I'm not sure I ever used personally but heard enough horror stories about that I basically refused to actually use any VCS until git saved the world)
A commit (or more often, a series of commits) can be used as a diff by virtue of looking at the history pointer. But there are enough footguns that thinking in terms of diffs alone is clearly harmful.
- krupan 3y agoIf you don't like losing branch names then I'm genuinely curious what you think is wrong with Mercurial's solution?
- o11c 3y agoMercurial branches get in the way. Branches should be recorded in commits, not contain or constrain commits. `git` records one side's branch name for merge commits, which is great ... except it doesn't record the other, or record anything for fast-forward or rebase. And what it does record isn't directly machine-readable.
- krupan 3y agoHmm. Are we both talking about Mercurial branches and not maybe bookmarks or something different? It's been a while since I've used mercurial but from what I remember the branch name is recorded as part of the commit? I'm not sure I understand what you mean by containing or constraining or being in the way, either, sorry. If you are rebasing you are modifying history generally to purposefully remove a branch in the DAG. I'm not sure you'd want to keep a branch name in that case?
- chthonicdaemon 3y agoI cannot find any reference for "`git` records one side's branch name for merge commits". From what I understand a merge commit just has two parent references (commit hashes) instead of one.
- o11c 3y agoIt sets the commit message to: Merge branch 'feature' (several variations exist) and when people add a real commit message, they generally preserve that much at least. With certain reasonable git workflows this technically does preserve sufficient metadata, but there are far too many edge cases for completeness.
- deleted 3y ago[deleted]