by mabbo · 4y ago · 0 comments
That's maybe not a good sign about the usability of git.
That `@{'3 days ago'}` thing? That's incredible. Why didn't I know about that 8 years ago? Why wasn't it obvious, intuitive to me that this was possible?
git is brilliant and I love it. But there are very few affordances that make it obvious what to do next, what is possible. There's few patterns in it where I can apply what I already know.
The thing that replaces git will have most of the power of git, but an intuitive interface that makes learning everything about it easy.
If I can humbly offer a suggestion: read the man pages. A man page read once thoroughly is much more useful than the same man page skimmed 1000 times. The syntax in question is in the rev-parse man page (`git help rev-parse`).
These are tools we use every day. Look, I'm the first person to throw out those furniture assembly instructions and dive right in. But the truth is, we'd all be better off reading the documentation for our tools.
The git man pages are far from the best, but they contain tons of useful information.
And it's not just with git that developers seem allergic to reading documentation. I noticed a colleague the other day doing this from a shell script:
BRANCH=$(python -c 'import os; print(os.environ["BRANCH"].split("/")[1])')
I asked what they were trying to do. They wanted to strip "origin/" from the front of BRANCH. I showed them you can do that directly in the shell: BRANCH="${BRANCH#origin/}" # strip origin/ from front
Or: BRANCH="${BRANCH#*/}" # strip */ from front
They'd never read the bash man page. Had no idea the shell could do this. So I pointed them at https://www.gnu.org/software/bash/manual/html_node/Shell-Par...I think we'd all be better developers if we RTFM, at least for the tools/languages we use every day. You simply don't know what you don't know. This way you at least know a little more what you don't know. :-)
Apple products became what they are because no manual was needed. They were designed with patterns that were intuitive, affordances, and a deep understanding of human psychology.
What I am arguing is that git lacks those very things that make reading a manual not needed.
I'm 25 and a couple weeks ago I discovered a new way to use a knife to prepare a fish, even though I've been doing that all my life. I don't think knives or fish have bad UX, even though I keep discovering new ways to use knives on fish. What's important is that I don't keep discovering new ways to hurt myself with knives.
Git is more like… the new car. It’s complicated and most people have no idea how it works, but they know how to steer very simply and can drive it with a bit of training. Experienced people however, who know how cars work, can do really cool things with them and have no problem repairing them on their own.
Still, cars are useful. A bike would be better of course.
I never copy them from stackoverflow because I'm worried it does some weird magic that I don't want. Instead I build them against one or more examples.
There is nothing new under the sun.
Joel, 22 years ago:
There’s a subtle reason that programmers always want to throw away the code and start over. The reason is that they think the old code is a mess. [...] The reason that they think the old code is a mess is because of a cardinal, fundamental law of programming: It’s harder to read code than to write it.
https://www.joelonsoftware.com/2000/04/06/things-you-should-...
I'm not associated with them, and I understand you don't seem to have any real issues with regex, but thought this would be a good place to mention a useful tool.
If I did this all the time, I might not need tools like this. But complex regex are something I only dive in to a handful of times per year, and it's never the same problem twice.
Which of course always happens at least once or twice in any new dataset/usage.
I really appreciate the availability of tools like that.
See also the Emacs built-in M-x re-builder (for elisp-style regexp).
See my sibling comment. Joel says you are just normal.
> even after a decade of using git as a mandatory part of my professional life, I'm still learning new things.
I still learn new things in Python every month. I still learn new things in Magento every _day_. I'll learn something new in VIM or PyCharm or PhpStorm at least once every few weeks. I'll learn something new in my native language every few weeks, and I'll learn something new in my other languages almost every day. I'll learn something new about Bash or Linux or CORS or Selenium or some useful Chrome or Firefox setting or extension at least every week.Learning new things is not unusual in the software development industry.
Oh we do, and we understand how most of it is a flaming trash pile.
I love git. I just wish it was more usable.
They could have used time spans from ISO 8601 standard, so for instance simply "P3D". Or "P3Y6M4DT12H30M17S".
git is powerful but it involves a higher amount of time investment than it could if it were not reinventing the wheel and taking shortcuts as much. It's easy to see that it is and was built for powerusers mainly.
When it comes to presenting it nicely, then sure, use 3 days ago. No problem with that.