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: ``` bash .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 <code>gc</code> and the terminal recognizes it as <code>git commit -m</code>. One that is not as common, but extremely helpful is <code>glod</code>. This command gives you a really nice list of your commits and where each branch is located within the commit tree. A sample <code>glod</code> output:
08ea36f (HEAD, master) most recent commit b2e9b3c commit20 975e9db commit19 a8c3bd8 (heroku/master) commit18 e0cb763 commit17 09dbd13 commit16 4a645b8 commit14 ac8f94a commit13 eb82a21 commit12 19e543e commit11 08fd498 commit10 c6b5da2 commit9 ebc27b1 commit8 2bc6d9f commit7 44348f4 commit6 afd6c1b commit5 c0b40f5 commit4 c96744a commit3 65f0e79 commit2 ad321a4 commit1 ```
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