There’s tons of stuff out there that can improve your programming efficiency, but one of the easiest and simplest ways to do this is using Bash aliases. A Bash alias is essentially a keyboard shortcut, an abbreviation that allows the user to avoid typing long command line sequences. Personally, I use aliases for my git workflow. Although this isn’t the most time consuming process in the first place, aliases cut the time from a little under a minute, to a matter of seconds.
To use Bash aliases on OSX, open your bash profile:
$ open .bash_profile Once inside, the syntax to create an alias is really simple:
Here’s a look at my bash profile:
alias gst='git status'
alias ga='git add .'
alias gc='git commit -m'
alias gp='git push'
alias glod='git log --oneline --decorate'
These are pretty straightforward and common; type
gc and the terminal recognizes it as
git commit -m. One that is not as common, but extremely helpful is
glod. This command gives you a really nice list of your commits and where each branch is located within the commit tree. A sample
08ea36f (HEAD, master) most recent commit
a8c3bd8 (heroku/master) commit18
Obviously, there are tons of even more useful stuff you can do with Bash aliases, but that’s just what I use to make my workflow just a bit more efficient. For more Bash alias ideas, click here