So yesterday I was looking into my command line usage and what are the most frequent command(s).
Here is link to part 1.
Obviously I spend a lot of time working the git. So most benefits I would gain if I could do something to improve that part. I already noticed that typing git commands is very verbose.
I also remember in the past when I was doing such analysis, tool would produce aliases for commands you frequently use. This is all fine, but it was hard to remember those commands, and it would take me more time to remember what was exactly shortcut, then to type it. So I quickly abandoned such system.
This time it will be different. For start, I am pretty sure that aliases like gp, gc etc, will not give me benefits. This got me thinking, how else can I name aliases that I can skip step where I pronounce command I want to be able to remember beggining letter. How about removing git from beginning?
Here is what I did:
first, so that I don’t have to create separate aliases in laptop and multiple desktops, I created a file in dropbox ‘aliases’ and in my .zshrc I added line to source it like this:
Then I started creating aliases. I made point to make them like I would think of those commands. For example ‘push’ is for ‘git push’
# git commands
alias s=”git status -s”
alias c=”git commit -m”
alias gd=”git diff”
alias add=”git add ”
alias log=”git log –oneline”
alias reset=’git reset HEAD –hard’
alias push=”git push”
alias pull=”git pull”
alias pick=”git cherry-pick ”
This helps me great deal. First day it took me a little time to get used to it, old habits die slowly. However, since it is intuitive, it works great.
One thing I am not super happy is gd for git diff, but diff is utility and we should not create confusion. On the other hand, as someone who likes to call git status, between pretty much most of the steps, shortening this and commit, is awesome.
Now, workflow would be something like this:
s (git status)
add . (git add .)
c “zd [#xxx] my feature” (git commit -m …)
So this alone helps me great deal. What else I would like to improve is folder traversing. This will be topic of next post tomorrow.