We all look like hackers when using the terminal (specially if we have green over black theme) but the truth is we tend to be amazingly lazy, and start using poor techniques.
I'm very untidy on my life, and I'm used to save the git clones in brand new directories so for example, in order to enter in my cloned repo, I have to...
# cd random_named_dir
# cd cloned_repo_dir
or even worse:
#cd random_nam*
#cd *
When updating my git, (I'm sorry, probably my virtual infrastructures' teacher will read this) in hurry I might write:
git add .
I sometimes save stuff in $HOME but later I don't remember where did I put 'em, or complain and sigh when I have to write my password in sudo because a long time passed since the last time I wrote it.
What are your most dark lazy secrets on the terminal? Do you want to change that and start using the terminal properly even in hurry? :p
Top comments (44)
These don't sound lazy at all, but just properly following the path of least resistance.
Though it sounds like some of these (like the
cd
example) could be simplified with Tab-completion.I really hated copying and pasting or typing out individual filenames with git, so I started using github.com/holygeek/git-number which gives the ease of a git gui to the git cli.
My motto for shortcuts and aliases is that "I just hate typing" even though I really don't, but it forces me to think "how many times do I do this?" what if I cut the command in half?
I never get to write aliases for git * which I use every single day. I should do it now.
I hate using
rmdir
and I always writerm -rf
because it happens that I need to remove multiple files and directories at once and I'm to lazy to write multiple commands :(Thanks for sharing, I love this kind of content! :)
I like to use trash, It's a lot better tool. check it out! npmjs.com/package/trash-cli
Thanks, I'll give it a try ! :)
but don't forget to make alias, so you get
trash
when typingrm
That's a bad idea, scripts might use
rm
and it starts adding up to your trash. Also, if you keep the habit of usingrm
you might be less careful when using it on a machine that doesn't have trash installed.Solution: For now, make
rm
print something like "no, use trash", and get a habit of usingtrash
overrm
.Good observation!
In fact, I don't think I'll continue to use
trash
because it's relatively slow compared torm
. Finally, it's a part of my job to think before acting ¯_(ツ)_/¯.No no no that's not what I meant! Even if I barely ever need to restore from trash, it's really nice to not feel worried you're destroying your system. Also, shouldn't moving directories be faster than deleting each file?
I'm guessing NodeJS
fs
is not as fast as the linux filesystem ? ^You were using a NodeJS version of trash-cli? Try github.com/andreafrancia/trash-cli.
I tried the version mentioned earlier:
github.com/sindresorhus/trash-cli
I'll give a try to yours :)
Always choose the first result on Google ;)
I do the same!! Oh my..
Hm... I guess mine would be stuff like
git amend
aftergit push
, alsogit push --force
:DAliases for lazy people :
Git aliases for super lazy people :
With a lazy alias to show other lazy aliases (la)
Sometimes I need to just type something into the clipboard (sometimes to avoid memorizing it!), so this one comes handy for me often
For me, it's stopped jobs. It's rare that, in a window where I'm actively working, I don't have less than 6 stopped jobs (at least 2-3 ipython shells, lessing some file, maybe a man page or two). In some cases, I've had over 20.
I had the same tmux session on this one machine for at least two years, then recently it just died (of old age, I presume). I was devastated.
I constantly
git stash
and completely forget what I stashed, then just end up runninggit stash clear
anyway and rewrite whatever I was doing.Definitely have had times where I had more than 7 stashes saved though...
git stash
is bae <3 ;)
Some
.bash_aliases
that I forget to use all the time haha. Plus, I have a folder namedgithub
togit clone
all the things, and a folderrepos
for my projects that I leave halfway (that's sad now that I think about it:'(
).I made a script for committing to GitHub because I am too lazy to commit normally.
Wait, I'm not supposed to use
git add .
? Usually, I want all the changes I made in the directory to get committed.It's not a good idea. You could add generated files, backups, and conf files with stuff you don't want added. It's better to use (small) trump cards like *.png or simply add file by file. You don't need to use git add every time you commit, git commit -am "message" will add to the commit everything that has been modified.
You could, but I typically have a command line + visualization set up and in most cases, I go with
git add .
and go through the verification step visually beforehand.Well, I don't know. Your
.gitignore
really needs to be configured correctly, as a rule. I haven't added a wrong file in three years.I always use
git add -p
solved the problem for me tooWell, I don't know. You might have some secret information in a .json or in a .yml file. You might exclude it by name in .gitignore, but then you would have to remember to do so. Routinely doing individual (or pattern inside a directory) is a better practice where you don't have to remember to add every possible file with non-public information to .gitignore.
Well, first of all,
.gitignore
is smarter than that. You can exclude using patterns and directories, the same as you can do forgit add
.Second, in most cases, you shouldn't be putting secret information in the repository to begin with. Use a separate directory.
Third, think about the mind-memory load you're talking about here. Either you remember all the files with non-public information once and add it to a file (
.gitignore
), or you remember all the files period and discriminate which to add every single time (git add
). You're having to remember what not to add ANYWAY. If you can use a mental shortcut like "Well, I never change .yaml", then you should be adding*.yaml
to.gitignore
. Work smarter, not harder.In the end, it may depend on the project. I have never worked on a project where manually using
git add
instead of.gitignore
was worth the tremendous expenditure of effort. There may be exceptions.Ultimately, remember that Git offers both features because one size doesn't fit all.