I think the worst error message of all is git push on a feature branch after rebasing to main, which returns exactly the error message she describes first. Git tells you to do a git pull, and that is the most destructive thing you could do, it completely screws up your history. It literally instructs you to ruin the entire thing. Instead, you need to do git push --force-with-lease to update that feature branch with the new, rebased history. I have made this mistake myself and I have seen it so many times with git novices. So much confusion and breakage. Git should rather just shut up and not tell you to do anything, or present all the options at your disposal. Especially if you just rebased your feature branch to main and then run into a push conflict, what could you possibly be up to? Git needs to be way smarter about things like that. I wrote a small git manual for work and every time this problem happens, I can tell them “yep, it’s that problem again, here’s the link to the chapter in the manual”.
-You are in a detached head state.
+You are no longer on a branch.
(Aside: The deeper problem is that Git only considers leaf commits to be on the branches they are on – between humans, you are still on zero or more branches; Git just doesn’t support that notion. But that’s a datastructure problem – commits only know their ancestors.)
my (least) favourite is this gruesome error that made me spit out my coffee in horror the first time i encountered it:
error: could not detach HEAD
i mean wtf? ☠️ noone actually building a product would ever use messages like that, not even for comic effect.
git has hostile ux. to use it well, humans have to learn a ton of git-specific gobbledigook. git seldom attempts to tailor its output to human readers. this makes it extremely hard to learn, and tons of tutorials and online resources serve as proof of that.
(i consider myself a git power user, and i have taught git to many other engineers over the years. no, it’s not about ‘just making an effort’. ‘sharp tools are dangerous’ also doesn’t quite cut it – actual pros always wear protective gear)
Actual pros frequently do not wear protective gear, because it slows them down and gets in their way, and they feel (justifiably or otherwise) that the gear isn’t contributing enough to their safety to be worth the cost.
I wonder how difficult it would be for Julia Evans herself to contribute a patch to the git project that improves these error messages in the way she suggests, or at least open up an issue with them. Git is not constant of the world handed down from on high, it is an open-source software project, and in principle it should be possible for any random user of it to submit a patch to make it better.
I think the worst error message of all is
git pushon a feature branch after rebasing tomain, which returns exactly the error message she describes first. Git tells you to do agit pull, and that is the most destructive thing you could do, it completely screws up your history. It literally instructs you to ruin the entire thing. Instead, you need to dogit push --force-with-leaseto update that feature branch with the new, rebased history. I have made this mistake myself and I have seen it so many times with git novices. So much confusion and breakage. Git should rather just shut up and not tell you to do anything, or present all the options at your disposal. Especially if you just rebased your feature branch tomainand then run into apushconflict, what could you possibly be up to? Git needs to be way smarter about things like that. I wrote a small git manual for work and every time this problem happens, I can tell them “yep, it’s that problem again, here’s the link to the chapter in the manual”.One obvious improvement:
(Aside: The deeper problem is that Git only considers leaf commits to be on the branches they are on – between humans, you are still on zero or more branches; Git just doesn’t support that notion. But that’s a datastructure problem – commits only know their ancestors.)
my (least) favourite is this gruesome error that made me spit out my coffee in horror the first time i encountered it:
i mean wtf? ☠️ noone actually building a product would ever use messages like that, not even for comic effect.
git has hostile ux. to use it well, humans have to learn a ton of git-specific gobbledigook. git seldom attempts to tailor its output to human readers. this makes it extremely hard to learn, and tons of tutorials and online resources serve as proof of that.
(i consider myself a git power user, and i have taught git to many other engineers over the years. no, it’s not about ‘just making an effort’. ‘sharp tools are dangerous’ also doesn’t quite cut it – actual pros always wear protective gear)
Actual pros frequently do not wear protective gear, because it slows them down and gets in their way, and they feel (justifiably or otherwise) that the gear isn’t contributing enough to their safety to be worth the cost.
I wonder how difficult it would be for Julia Evans herself to contribute a patch to the git project that improves these error messages in the way she suggests, or at least open up an issue with them. Git is not constant of the world handed down from on high, it is an open-source software project, and in principle it should be possible for any random user of it to submit a patch to make it better.