Command line productivity (Part 2)

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:

source /Users/zeljko/Dropbox/Apps/aliases

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 …)



push –tags

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.



4 thoughts on “Command line productivity (Part 2)

  1. Tom Ordonez (@tomordonez) August 22, 2013 / 2:21 pm

    Here is my suggestion instead of the aliases you have:

    > alias kickass = “git push”
    > alias score = “git status -s”
    > alias getfat = “git add”
    > alias oops = “git reset HEAD -hard”
    > alias babes = “git cherry-pick”

    It would make this coding thing more fun

    • Zeljko Dakic August 22, 2013 / 9:30 pm

      Whatever works for you, but I have to agree this is really amusing way to approach aliases. And no way you will get confused over what each do.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s