by wokwokwok · 5y ago · 0 comments
I feel like this is mostly accurate, to my knowledge, but reading this:
> I do not claim that this way of looking at Git represents absolute “facts” in any hard and fast or literal sense. But I contend that if you conceive of Git in the way that I’m going to suggest, if you substitute these conceptions of Git for any misconceptions you might have now, you’ll be a much happier and more fluid Git user.
…vexes me.
“Think of git like bowl of peanuts and marshmallows” and other pointless, wrong, metaphors about how git works are a dime a dozen.
Yet, here is someone who is clearly quite familiar with git, and they go to pains to point out they are simplifying and may not be correct in their explanations.
Its good to be humble, but ffs, git is too frigging complicated if the best you can get is a “probably wrong simplified mental model of how it works so you can be a bit more productive with it”.
I dont care;
- a simple meaningless metaphor that lets you be more productive? OK.
- a accurate description of how things actually work? OK.
…but pick one.
What I do not want is a possibly wrong complicated explanation of how git maybe works.
I would argue most things in technology are complex, and mental models are intentional ways to take something complex and turn it into something more simple. This article does not create meaningless metaphors.
Personally speaking, I find knowing and distinguishing among the 4 indexes to be essential to understanding git. Not including and really exploring that detail gives people an incorrect mental model of what's happening.
Marvelous, if the metaphors of the article helped you, but I empathize with the upstream poster's frustration. I believe that the content of the article is not medicine for the malaise it describes.
working directory - this is the project directory in the OS file structure
index - a.k.a the staging area
repository - in the .git directory
stash - a kind of scratch pad or clipboard for the developer
Understanding these different areas and how and why to move data into each is essential to understanding git
The command line interface to git is insanely complicated, confusing, and unnecessarily difficult to use, but this isn't a result of the git data model. It's definitely possible, to give a complete and accurate description of the data model, even using examples from `git cat-file` to walk through the commit history by hand.
I've also got a simple demo that generates a complete repo with a commit. You can manipulate the resulting repo from git. There are 65 non-comment lines of code.
Here it is: https://orib.dev/ugit.py