this post was submitted on 08 Nov 2023
63 points (100.0% liked)

Programming

423 readers
3 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] homoludens@feddit.de 48 points 1 year ago* (last edited 1 year ago) (3 children)

I disagree, hard.

I disagree with the general conclusion - I think it's very easy to understand*: each repo has a graph of commits. Each commit includes the diff and metadata (like parent commits). There is a difference between you repo seeing the state of another repo (fetch) and copying commits from another repo into your repo (merge; pull is just a combination of fetch and pull). Tags are pointers to specific commits, branches are pointers to specific commits that get updated when you add a child commit to this commit. That's a rather small set of very clear concepts for such a complex problem.

I also disagree with a lot of the reasoning. Like "If a commit has the same content but a different parent, it’s NOT the same commit" is not an "alien concept". When I apply the same change to different parents, I end up with different versions. Which would be kinda bad for a Version Control System.

"This in turn means that you need to be comfortable and fluent in a branching many-worlds cosmology" - yes, if you need to handle different versions, you need to switch between them. That's the complexity of what you're doing, not the tool. And I like that Git is not trying to hide things that I need to know to understand what's happening.

"distinguish between changes and snapshots that have the same intent and content but which are completely non-interchangeable and imply entirely different flows of historical events" How do you even end up in a situation like that? Anyway, sounds like you should be able to merge them without conflicts, if they are in fact completely interchangeable?

"The natural mental model is that names denote global identity." Why should another repo care, which names I use? How would you even synchronize naming across different repos without adding complexity, e.g. if two devs created a branch "experimental" or "playground". Why on earth should they be treated as the same branch?

"Git uses the cached remote content, but that’s likely out of date" I actually agree that this can lead to some errors and confusion. But automation exists - you can just fetch every x minutes.

"Branches aren't quite branches, they're more like little bookmark go-karts." A dev describing what basically is just a pointer in this way leads to the suspicion that it might not be Git's mental model that is alien.

"My favorite version of this is when the novice has followed someone's dodgy advice to set pull.rebase = true" Maybe don't do stupid stuff you don't understand? We know what fetch is, we know what merge is. Pull is basically fetch & merge.

""Pull" presents the illusion that you can just ask Git to make everything okay for you" Just... what? The rest of the sentence doesn't really fix this error in expectations.

  • except the CLI of course, but I can use GUI-tools for most tasks
[–] potterman28wxcv 20 points 1 year ago* (last edited 1 year ago) (1 children)

Hot take: Git is hard for people who do not know how to read a documentation.

The Git book is very easy to read and only takes a couple of hours to read the most significant chapters. That's how I learnt it myself.

Git is meant for developers, i.e. people who are supposed to be good at looking up online how stuff works.

[–] nous@programming.dev 15 points 1 year ago

developers, i.e. people who are supposed to be good at looking up online how stuff works.

How I wish this were true.

[–] aport@programming.dev 7 points 1 year ago (1 children)

Each commit includes the diff and metadata (like parent commits).

Commits don't store diffs, so you're wrong from the start here.

Hence why people say "git is hard"

[–] homoludens@feddit.de 3 points 1 year ago

Yeah, you're right, technically it's not a "diff", it's the changed files.

I don't think this technical detail has any consequences for the general mental model of Git though - as evidenced by the fact that I have been using Git for years without knowing this detail, and without any problems.

[–] bizdelnick@lemmy.ml 3 points 1 year ago* (last edited 1 year ago)

Each commit includes the diff

It doesn't. ☺