30 points · by todsacerdoti · 2y ago · 65 comments
People are told this because it's generally true. Of course, it's not the case for everyone, but I find that most criticisms of the tool focus heavily on remembering how to use it.
(The author does mention some missing features, which is valid, but git can't be everything for everyone. In those cases, perhaps it's not the appropriate tool.)
> I need to always deeply understand the difference between reset, revert, [...]
> You need to remember that push and pull [...]
> When it comes to merging, you need to think through the logic [...]
Yes, you need to understand, remember, and think. Git (and other similar tools) solve a complex problem and doing so in a simple way would likely restrict teams into a small set of possible workflows.
I find that using git is quite simple once the project team has established the processes where the tool is used, and understands git's role in those processes. In my experience, most day-to-day tasks involve using the same small handful of git subcommands, and issues that arise are quite easily fixable.
Another way to look at this is that Git is a bad UX for what the correct and convenient tool for development is.
Is like when people wanna do JOINs but what you have is documents and map-reduce. Sure, you can bend towards it, but then the tool is ill-suited.
"So pick a better tool"
We do (mercurial). Sadly `git` won.
or because tool is unnecessary complicated?
Like anything used by a lot of people to solve real problems, it has warts and duct tape, but, honestly, git feels like the least troublesome part of my daily workflow.
The problem with Git is the same kind of problem Excel has: everyone can (correctly) claim to only use 20% of its features, thus everyone can say "Git is too complex!". But the problem is that everyone uses a different 20% of Git; Git is the union of the solutions to lots of different problems.
If you're working on any kind of team doing work in parallel.. Just dont bother with SVN.
Got can get into strange states sometimes but I've never not been able to fix it. I don't personally find the same difficulties as the author though.
> Why do I need to download 500 files in a project if I'm only going to edit 3 of them
Either their project structure sucks and they combine a lot of unrelated items together, or this guy is just an manager/architect who isn't making any significant changes but wants to poke in the codebase.
Why do you need to download the entire project? So you can build/compile/launch it and view/test your changes. Are we just talking about a README.md file here?
Put another way, in a software product, you bring down those 500 files because you want to locally make sure that your changes to the 3 files you care about are compatible with the 500 files you don't. In a dev-ops repo, perhaps they are dealing with a situation where small amount of files they deal with have less impact on the whole.
> In a dev-ops repo, perhaps they are dealing with a situation where small amount of files they deal with have less impact on the whole.
Do they not test against the real thing and assume their test cases hit every corner case?
Edit: Also as a DevOps person it is your responsibility to make sure things work well. If this is onerous for you and you're not doing anything to make it better and instead are trying to shy away from the reality of working with the reposit, you're doing your job wrong.
Then just create a few aliases for yourself and forget the rest.
People think that git is complex. It is.
The task it's accomplishing is insanely complicated.
Easily accessing, rearranging, and merging the changes between those versions gets complicated, but git isn't actually very good at those parts!
Use `git switch` instead. `git checkout` is known to be overloaded to do too many things.
If it's a new branch, `git switch --create <branch>`
If it's an existing branch and the changes would conflict, `git switch --merge <branch>`
I've often wondered why I seem to be in the minority on this opinion. Most devs seem to be OK with it, and many love it. I have no idea why.
The only thing I can think of is that git operates in a very specific way and either your brain is in sync with that way or it isn't.
One thing I disagree with in the article:
> More specifically, it doesn't work offline
It absolutely does. Maybe the author is confusing git with one of the bit-based services like github?
That was the most confusing paragraph. It says that “pull request” merges aren’t part of Git or something. Of course the merge itself is part of Git. I certainly would have heard something by now if people were getting different merge results when using GitHub compared to git(1).
Also
> Most of that distributed history gets thrown away when I do a squash.
Step (1) use squash; step (2) complain that squash throws the history away.
I’m not sure it’s possible to do so without a huge regression in usability. Multiple people working concurrently on a codebase is a fundamentally decentralized activity. One of the big problems with the cvs/svn concurrency model is that you have to resolve conflicts (which corrupts your work in progress) before you can commit your edits, whereas with git the workflow is commit first then resolve conflicts. git gives you a lot more safety than svn, and more flexibility and tooling for managing work in progress.
Not only that, but then followed it up with:
> Pull Request as a first-class citizen.
What on Earth for?!? If you only have a centralized repository, what else is there to pull from?
Luckily I can still find yesterday's article about credit cards rewards at the top. I think there's a perverse incentive around flagging.
I've also used svn for a long time, and I remember it fondly. With git, you use git. With svn, you can actually code. Since it's become non-optional to use git, I just use commits and logs. I don't even bother with branches anymore, they bug out too often. I've become so jaded about tools, and git is a major reason for it.
There's always something 'wrong' with Git because it's incredibly complex. Most developer flows don't require that complexity, but have to pay for it anyway. That's the article.
When I have significant changes, I copy the directory before messing with Git beyond regular commands, because it's so easy to nuke code with it. Someone could tell me I'm doing it wrong, but an LLM could generate that comment at this point, so don't bother.
Git's docs have quite well written guides and introductory material but how many developers have ever even read those docs, even in part?
I can't think of a single other tool or library I use on a regular basis that has documentation but it's considered standard practice to just ignore all those docs and "wing it" based on colloquial knowledge and random copypasted snippets from stack overflow.
Everywhere else in the tech space RTFM is standard practice but as soon as you say that with git, it's interpreted as if it was said with complete and utter condescension.
(aside: you can still dislike git and there are perfectly valid reasons to but so often I see people argue that git is bad without ever having experience following the instructions printed on the tin)
That is not what is happening here.
Simply being better than SVN is not very hard, and most git workflows accomplish that.
> When I have significant changes, I copy the directory before messing with Git beyond regular commands, because it's so easy to nuke code with it. Someone could tell me I'm doing it wrong, but an LLM could generate that comment at this point, so don't bother.
If you're committing first, I doubt it's actually nuked.
If you're skipping committing before doing strange things, then stop doing that. That's not some kind of condescending and useless "do it better", it's like telling you to flip the breaker before you start rewiring your house.
Nope, that's not it. Sure, git is too complex for any single user or team to effectively use all of its features. That's a consequence of the famous "Everyone only uses 10 (5, 20, whatever) percent of its features -- but it's a different 10 (...) percent for everyone!" dictum.
But this article was a self-contradictory mishmash that showed only that the author doesn't really have any idea what he's talking about. Case in point:
> Dump the decentralized model.
> Pull Request as a first-class citizen.
What would you need pull requests for without a decentralized model?
In practice you just want server with local commits.
...and the author has lost me (I did read the entire post though).
> If GitHub is down today I can't deploy anyway so I might as well embrace the server requirement as a perk.
Just because you can't deploy doesn't mean others can't as well. (Also, GitHub != Git. Period.)
Heck, the entire idea of DVCS is that you should be able to continue to work even after the servers are down. If you can't, then it's not Git problem.
It seems that the author didn't even understand the concepts and ideas, or the rationals behind DVCS, let alone Git. As a someone who had lived through the period when SVN was the only game in town (and not wanting to return to those dark days), seeing the author pining for the "good 'ol days" of SVN-like, centralized VCS is just silly.
Other git tools like Gerrit that focus on rebases and chaining of commits are far superior in terms of getting code through review in a clean and efficient manner.
https://www.reddit.com/r/git/comments/pa656j/wrappers_on_top...
Yeah, the problem is git is too low level for almost everything a dev does during the day. It really needs a tool on top of it that makes the simple tasks easy (and it must be possible, because Perforce is waay easier to use than git and works like a charm, at least in my opinion).
... but, at the same time, git is great for automation because the build-tool devs have some much control, so keep it as a foundation.
> More specifically, it doesn't work offline.
??? Of fucking course it does! You mean Git Hub doesn't work offline, don't you?
> It relies on merge controls that aren't even a part of git with Pull Requests.
No, git doesn't "rely on merge controls that aren't even a part of git". Other things do. Things people nowadays confuse with git. People like, apparently, the author of TFA. (And no, the "F" doesn't stand for "fine" in this case.)
> Dump the decentralized model.
You can do that yourself: Just don't use it.
> Move a lot of the work server-side and on-demand.
Sure, just ssh into the server and run your search there. What's your problem?
> Pull Request as a first-class citizen.
A: Huh? But that's part of a decentralized workflow, and didn't you just say to "Dump the decentralized model"? Make up your mind.
B: "git request-pull": https://git-scm.com/docs/git-request-pull
> Why did SVN get dumped then? One word: branches.
Yeah, that is a bit ironic... Seeing as how git's killer feature was branches, and for the last ten years (or how long has it been; at least five?) everyone has been pooh-poohing them and going on about their "linear commit history", as if that were somehow so fucking important.
> I also think programmers love decentralized designs because it encourages the (somewhat) false hope of portability. Yes I am entirely reliant on GitHub actions, Pull Requests, GitHub access control
Who told you to make yourself dependant on all that shit? I sure didn't, and I'm pretty sure git didn't either. Sounds -- again -- like your problem is with GitHub, not with git.
> I could move the actual repo itself to a different provider.
Your problem is probably that you think you need a "provider" in the first place. Just put a fucking ordinary git repo somewhere, and use that.
Sheesh.
> I've been working with git now full-time for around a decade now.
Duplicated "now". Boom, roasted.
I’m not implying this was the point you’re making at all, but imo a Git GUI should be for aiding visualisation and to avoid needing to type the (sometimes unintuitive) commands rather than to avoid learning Git itself. I think this is what causes many people to get stuck.