Archive:
Subtopics:
Comments disabled |
Wed, 29 Jun 2022
Things I wish everyone knew about Git (Part I)
This is a writeup of a talk I gave in December for my previous employer. It's long so I'm publishing it in several parts:
How to approach Git; general strategyGit has an elegant and powerful underlying model based on a few simple concepts:
Built atop this elegant system is a flaming trash pile. The command set wasn't always well thought out, and then over the years it grew by accretion, with new stuff piled on top of old stuff that couldn't be changed because Backward Compatibility. The commands are non-orthogonal and when two commands perform the same task they often have inconsistent options or are described with different terminology. Even when the individual commands don't conflict with one another, they are often badly-designed and confusing. The documentation is often very poorly written. What this meansWith a lot of software, you can opt to use it at a surface level without understanding it at a deeper level: “I don't need to
know how it works. This is often an effective strategy, but with Git, this does not work. You can't “just know which commands to run” because the commands do not make sense! To work effectively with Git, you must have a model of what the repository is like, so that you can formulate questions like “is the repo on this state or that state?” and “the repo is in this state, how do I get it into that state?”. At that point you look around for a command that answers your question, and there are probably several ways to do what you want. But if you try to understand the commands without the model, you will suffer, because the commands do not make sense. Just a few examples:
If you try to understand the commands without a clear idea of the model, you'll be perpetually confused about what is happening and why, and you won't know what questions to ask to find out what is going on. READ THISWhen I first used Git it drove me almost to tears of rage and frustration. But I did get it under control. I don't love Git, but I use it every day, by choice, and I use it effectively. The magic key that rescued me was John Wiegley's Git From the Bottom Up explains the model. I read it. After that I wept no more. I understood what was going on. I knew how to try things out and how to interpret what I saw. Even when I got a surprise, I had a model to fit it into. That's the best advice I have. Read Wiegley's explanation. Set aside time to go over it carefully and try out his examples. It fixed me. If I were going to tell every programmer just one thing about Git, that would be it. The rest of this series is all downhill from here. But if I were going to tell everyone just one more thing, it would be: It is very hard to
permanently lose work. Many more details about that are in the followup article. [Other articles in category /prog/git] permanent link Thu, 02 Jun 2022
Disabling the awful Macbook screen lock key
(The actual answer is at the very bottom of the article, if you want to skip my complaining.) My new job wants me to do my work on a Macbook Pro, which in most ways is only a little more terrible than the Linux laptops I am used to. I don't love anything about it, and one of the things I love the least is the Mystery Key. It's the blank one above the delete key: This is sometimes called the power button, and sometimes the TouchID. It is a sort of combined power-lock-unlock button. It has something to do with turning the laptop on and off, putting it to sleep and waking it up again, if you press it in the right way for the right amount of time. I understand that it can also be trained to recognize my fingerprints, which sounds like something I would want to do only a little more than stabbing myself in the eye with a fork. If you tap the mystery button momentarily, the screen locks, which is very convenient, I guess, if you have to pee a lot. But they put the mystery button right above the delete key, and several times a day I fat-finger the delete key, tap the corner of the mystery button, and the screen locks. Then I have to stop what I am doing and type in my password to unlock the screen again. No problem, I will just turn off that behavior in the System Preferences. Ha ha, wrong‑o. (Pretend I inserted a sub-article here about the shitty design of the System Preferences app, I'm not in the mood to actually do it.) Fortunately there is a discussion of the issue on the Apple community support forum. It was posted nearly a year ago, and 316 people have pressed the button that says "I have this question too". But there is no answer. YAAAAAAY community support. Here it is again. 292 more people have this question. This time there is an answer!
This question was tough to search for. I found a lot of questions about disabling touch ID, about configuring the touch ID key to lock the screen, basically every possible incorrect permutation of what I actually wanted. I did eventually find what I wanted on Stack Exchange and on Quora — but no useful answers. There was a discussion of the issue on Reddit:
I think the answer might be my single favorite Reddit comment ever:
Victory!I did find a solution! The key to the mystery was provided by Roslyn
Chu. She suggested
this page from 2014
which has an incantation that worked back in ancient times.
That incantation didn't work on my computer, but it put me on the
trail to the right one. I did need to use the To fix it, run the following command in a terminal:
They documenation claims will it will work on macOS 10.13 and later; it did work on my 12.4 system. Something something famous Macintosh user experience. [ The cartoon is from howfuckedismydatabase.com. ] [Other articles in category /tech] permanent link |