Think Like a Git, Commit Like a Boss: Save Time By Aliasing

Improving developer workflow is something I think about every second of every minute of every hour of every day of every week of every month of every year of my Life.

You should also. When you work, ask yourself these questions:

1. “How can I make this better?”

2. “How can I automate this process?”

It’s the very little things we don’t care about that matters, because it adds up over time.

In the previous posts, we have been running git commands like so:

Now, let’s save time by making Aliases for this commands. Aliases are simply other names something is known as. So now these commands will be known as:

If you go ahead to run these aliases on your terminal, it will still perform the same functions like writing the whole command fully :

gl – still shows us git history

gcmsg <commit-message>  – still adds a commit message

gst   – still shows the status of your files in git

grh <commit-hash>  – still delete changes in files and erase git history after the set commit-hash

This is so easy to implement. Head 0ver to your terminal and open your shell, if you are running the popular zsh which I think you should, run this:

For bash shell, it would be:

It opens a vim editor in your terminal where you can put your aliases, So go ahead and add them. Mine at the time of this writing looks like this:

Screen Shot 2015-08-19 at 7.15.49 AM

When you have added them, exit the vim editor, and run this command in your terminal:

For bash:

This simply reloads the terminal to effect those changes you have made to your shell without necessarily having to close and open up your terminal again.

For windows users, you could download the Winzsh  and follow the instructions here to have vim installed on your computer.

Now if you run the git commands using the Aliases, everything just works fine. Is that not totally Awesome and ESME(Eliminate Stupid Mental Efforts)!!! :smile:

Please, let me know if you have any questions in the comment section. Stay tuned for More!



Food Ninja, Code Slinger, Technical Trainer, Accidental Writer, Open Source Advocate and Developer Evangelist.