3 ms·
> some of the git's naming was also not intuitive for me, For example, calling the scratch area "index". I think this is the real problem. Git is actually real
by IshKebab 5y ago
> some of the git's naming was also not intuitive for me, For example, calling the scratch area "index".
I think this is the real problem. Git is actually really simple. The mental model is not even difficult - you can describe it in a sentence or two.
* Each commit is a snapshot of your code at a certain point. Like making a copy of your project and renaming the folder (but stored more efficiently). Commits also include metadata to say which previous commit(s) they are based on.
That's it.
All the difficulty comes from figuring out what the hell all the badly named and confusing commands do. As you mentioned I think "the index" is probably the worst - why not "draft commit" or just "draft"? That's what it actually is. It's so bad people even invented an unofficial name for it ("staging area").
It's not the only one. "Commit" is a pretty bad name in itself. It's not even a noun - "snapshot" would have been better.
And there's the commands... Look up how many different things `git checkout` does, or `git rev-parse`. And don't ask me how many times I've googled "git delete remote branch".
They did add `git switch` so I'm mildly hopeful that at least some people care.
- pm215 5y agoWeird naming is definitely part of the problem. I think the other part that makes git painful for beginners is that it does not mandate a workflow (do you have a central authoritative server? where is it? Do you merge master into working branches? Rebase all the time or never at all? Squash commits, or not? Etc). That means that as a newcomer you have to decide for yourself what workflow to use (at a point in time when you have no experience to help you in making that choice) and when you read tutorials or advice online you have to be able to spot whether the author of the advice is using the same workflow you are or whether their suggestions and command line options will not work in your situation. Earlier version control systems tended to be more dogmatic about how they were used, which is less flexible but easier to get to grips with.
- dagw 5y agoI think the other part that makes git painful for beginners is that it does not mandate a workflow That's a very good point. Every company I worked at that used SVN back in the day used it in basically the same way, making it very easy to get started. With git different projects even within the same company can have completely different workflows.
- fragmede 5y ago> that it does not mandate a workflow that's the only reason it gain adoption among other projects, which already had (different!) well-established workflows and let to it being where it is now.
- sreevisakh 5y ago> The mental model is not even difficult - you can describe it in a sentence or two. > * Each commit is a snapshot of your code at a certain point. > That's it. Unfortunately, it's a bit more nuanced than that. What you described is only git's storage format. Git operations and UI unfortunately isn't consistent with that model. Take for example, interactive rebasing. By your definition, if we delete a commit, the subsequent commits should remain unchanged - because commits are only snapshots after all. But that isn't what happens. The change introduced by that commit gets deleted from all subsequent commit. Commits are treated as diffs here. Git UI switches between snapshot and diff model quite often. Merges and rebases are all patch operations. Novice users can get away with being oblivious to this change for most operations till merges. But rebases require you to be aware of it. Even for experienced git users, large multi-commit interactive rebases are hard because git simply hides all the nuances of patching (you are better off rebasing in small chunks). This becomes immediately clear when you use a tool like quilt or stgit. In my opinion, this is something that prevents beginners from going beyond clone-commit-merge workflow and being able to create beautiful commit history like that of the kernel.
- TrianguloY 5y ago> By your definition, if we delete a commit, the subsequent commits should remain unchanged And that's exactly what happens. On a rebase, the original commits are not deleted, but the command creates new ones that matches the same diffs (unless there is a problem like an empty commit or a conflict). Normally those unused commits are 'lost' because no branch/pointer are now pointing to it, unless you have another branch which does. Later the gc removes those orphaned commits (although I think you do can restore them before that happens).
- IshKebab 5y ago> if we delete a commit, the subsequent commits should remain unchanged They are. You can get to them using the reflog. > Commits are treated as diffs here. Not exactly. For the rebase operation Git calculates the diff between subsequent commits and then reapplies them to make new commits, but the commits themselves are never treated as diffs. > Git UI switches between snapshot and diff model quite often. It doesn't. It allows you to perform operations that result in or consume diffs, but of course it does! They're useful things to do. How else would it work? It never treats commits themselves as diffs because that doesn't make any sense. Only the differences between two commits are treated as diffs (hence the name!)
- Zababa 5y ago> I think this is the real problem. Git is actually really simple. The mental model is not even difficult - you can describe it in a sentence or two. Being simple and being easy to use are two different things. Brainfuck is simple, but writing a hello world is hard. Python is superficially easy at the beginning, but I wouldn't call it simple. There is a balance to find between simple and easy, and git is on the simple side, at the cost of the easy.