3 ms·
On top of that, his opening example is so easy if you use a GUI for Git it's mind-boggling. It'd literally be click status column to sort, click top entry, shi
by mattmanser 6y ago
On top of that, his opening example is so easy if you use a GUI for Git it's mind-boggling.
It'd literally be click status column to sort, click top entry, shift-click bottom deleted file, right-click, restore. Done, a couple of seconds without even thinking about it.
And somehow this simple task in a GUI inspired a blog post about how useful the shell is.
I'm not going to deny a shell is extremely useful, and knowing far more than I do makes you a better programmer, but there's also using the right tool for the job.
- boogies 6y ago> Done, a couple of seconds without even thinking about it. This was originally done in a couple of seconds without deeply thinking about it (hence originally using grep instead of `awk '/re/'`). (Edit: quote)
- dan-robertson 6y agoThat relies on there being a sufficiently versatile gui which isn’t guaranteed. Here’s some features that your example requires which I often don’t see in guis: 1. Tables you can sort 2. Tables you can sort on the thing you actually care about 3. Being able to select multiple entries and act on your selection It’s not too hard to imagine criteria which could make the problem much harder for a gui, e.g. only doing the operation in a subdirectory (if the sorting is stable this isn’t so bad), or only on files not in a subdirectory (stable sorting won’t help here, you’d need the gui to let you eg search for / and then remove those things from your current selection), or only operating on .h files (you’d need a search->select feature again), or doing an operation that the gui doesn’t support on multiple files, or passing the list to some other tool (maybe you want to search makefiles for references to the deleted files). Something that a gui may be able to handle but that often screws up shells would be file names with newlines or spaces in them.
- turbinerneiter 6y agoIn the end, your are gonna write regex either way :D
- mattmanser 6y agoIt might not be hard to imagine it, but it's not actually that common an occurrence. When's the last time you accidentally delete 200 files and needed to restore them? Probably because you were using a shell... Oh yeah, and if you accidentally delete folder in a GUI? Usually you can just press ctrl-z, undo!
- natrys 6y agoThe point of the article clearly is about how a few general purpose shell tools can combine together to be the "right" tool in so many different usecases for which they weren't specifically designed for. You can argue for more specialized tool, and that's okay. But saying just "this" task inspired this blog post clearly misses the point of the article, which is generality. In any case there are like a bazillion of GUI git tools. Are you certain each and all of them support this feature? If someone doesn't know any of them, what are the odds the first GUI tool they install has this feature? The hidden cost of finding the "right" tool is overlooked in its advocacy.
- mattmanser 6y agoAnd there are a bazillion CLI tools, you can't use that defence.
- addicted 6y agoNow do it across 5 projects. Or help explain to all your teammates how to do it. With the shell, the second time you do it is a few keystrokes, if even. Wanna do it across multiple projects, it’s super easy without ever loading any of them in your IDE. Wanna share it with teammates, you simply need to pass a script file to them, and they can do it without having to do anything. And now finally if you need to incorporate this behavior in your headless CI? It’s the same script, instead of having to putz about with the CI configurations or whatever.
- mattmanser 6y agoa) It's not a common task b) a few keystrokes === a few clicks