by goku12 · 2y ago · 0 comments
I understand. I meant muddied (not muddled) in the sense that it can be confusing for beginners. For some reason, many long-time git users also don't seem to progress beyond the initial image they have. (That includes me too - I struggled with rebases for a long time). That description wasn't a criticism of the git model. Git model is clear if you take some time to study it.
> Packing is an implementation detail.
> The fact that internally it can store snapshots as diffs is more or less unrelated to the user-facing diffs.
My point exactly! To summarize, a git user needs to remember only two things:
1. Git commits are modeled as snapshots of work tree.
2. Many operations are (user-facing) diff-based.
Every other detail is a finer implementation detail that's good to know but not essential to get started.
Also, people really shouldn't teach implementation details to beginners. Or intermediates. Perhaps anyone who casually mentions that Git stores diffs to anyone not currently opening the source code for Git itself should be disqualified from ever giving explanations for technical stuff ever again.
Good way to think about rebase is that it's nothing more than automated reset and cherry-pick. You can rebase by hand without using `git rebase`, it's a convenience tool just like `git bisect`. `drop` does nothing, and removing the line does the same thing - it's just not cherry-picking that particular commit, skipping right to the next line. You can even add new lines to an interactive rebase and cherry-pick completely unrelated commits this way.
Once you know how cherry-pick works, rebase (and revert) becomes clear too.