DEV Community

Discussion on: Productivity 101: Git Aliases for Lazy Developers

Collapse
 
ghost profile image
Ghost

strangely I have the opposite aproach, all my aliases are for non-productive stuff, like playing YT videos on certain resolutions; I prefer to use git and docker and alike on their original form, when you have to work on a different machine is annoying as hell otherwise. You get used to your nice git aliases and you'll became useless and/or really pissed really quick in another PC, it happened often when ssh and I'm not a fan to add unnecesary config files inside VM or containers.

Collapse
 
mojemoron profile image
Micheal Ojemoron • Edited

Wow, I never thought of this :)

Collapse
 
ghost profile image
Ghost

and think about it, when you are on your own machine, you are all happy and cozy, that's when you don't need to be pampered by nice aliases; when you are SSH-ing to a machine, on the other hand, you probably are fixing something, for some reason your automated deploy didn't take, some service don't want to stay up, maybe you lost some data, you're probably pissed, frustrated and annoyed, your coffee is getting cold, is late on a Friday and you want to go home; that's exactly when you don't want to be extra-annoyed by repeatedly typing twice because of your in-existent aliases. That's the kinda thing that makes keyboards go through monitors, that's when you need to have the commands fresh on your mind and your fingers properly trained. You wont need to remember how to pass youtube-dl parameters to mpv nor how to load dmenu all cute with fancy color, those can be aliased, Docker, Ansible and Git?, you definetely want to remember those by hart. At least that's my opinion :]

Thread Thread
 
190245 profile image
Dave

In my corporate life, we have chef that pushes user config around servers, things like my SSH key, .bashrc and .gitconfig are pushed to any server(s) I should have access to, and kept in sync (because it pulls from our personal git repos).

In my personal life, I do much the same, but without chef (git clone <url> && ./firstTimeSetup). It sets up a cronjob that runs daily to pull changes.

That's my approach to the "finger training" issue. Then I simply don't need to think, other than remembering to look at the hostname in the terminal prompt to see where I am.

Automate all the things, and forget about the fingers!

Thread Thread
 
ghost profile image
Ghost

that's a good point, in my case I do it with Ansible, but I don't have a "corporate" machine, I work with my own one and I don't want my personal files into machines that are now my own, I also have, on occasion, get into docker machines that don't even have bash, dash is much more limited and I don't want to deal with error messages and logs just because something in my config files depends on my setup and also when more than one persona have to work in a VM or container which bashrc you use?, yours or theirs? or you add more aliases? or you put more users on them? and more entries in visudo, etc. things get complicated really fast, for some triviality like to type dc instead of docker container seems too much trouble for me. I prefer to keep things simple for my brain, my fingers can use some little extra work and the sum of all the commands written in a day are probably like 5min of coding.

Thread Thread
 
190245 profile image
Dave

Without wishing to prescribe a working method, I/we do things a little differently.

As I'm always repeating to our Junior developers - "a good developer is a lazy developer" and "don't be WET" (WET = We Enjoy Typing, the opposite of DRY - Don't Repeat Yourself). Kind of ironically, I'm breaking DRY by repeating that to the Juniors...

As a result, I never need to connect to anything that doesn't have a full bash installation. Even Docker containers, the images are stripped bare, so don't have bash etc, and if something is wrong within the container, it's either in a volume or the image needs a rebuild. Same for VMs, if it's not a full blown Linux installation, I've no need to connect to it - and if I do need to connect to it, chef deals with sync for me.

FWIW, I also don't rely heavily on bash aliases - about the only two I can think of that I use with any regulatory are ll (which is just ls -latrh) and msg (which will send a message to a user on another TTY in the same host - e.g. msg bob "dw, I got this production issue, grab a coffee").

Thread Thread
 
ghost profile image
Ghost

well it depends on the situation, in my case sometimes I do have to login into machines without Bash and as I mentioned, I've typed more in this couple of comments than in a day of commands, I argue that in this case KISS is more relevant to me, to avoid a couple of key-presses is just irrelevant to me. as I said a couple of minutes of coding has a lot more typing than the saved time, also remembering the aliases has a cognitive cost, that again, to me is not worth it, of course if I where a sysadmin and had to repeat the same commands hundreds of times it would probably be different, or if in your case you never have to deal with machines without bash. Almost everything is a trade-off that has to be evaluated case by case; I just wanted to pointed out the other side of the trade-off. And in that note, DRY is also not a universal law, it also carries it's own trade-offs, to evaluate them and take action in a case by case basis is part of our job.