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:
1 2 3 4 5 6 7 8 9 |
git status git reset --hard git log git revert git commit -m "<commit-message>" |
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:
1 2 3 4 5 6 7 8 9 |
git status -- gst git reset --hard -- grh git log -- gl git revert -- gr git commit -m -- gcmsg |
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:
1 |
vim ~/.zshrc |
For bash shell, it would be:
1 |
vim ~/.bashrc |
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:
When you have added them, exit the vim editor, and run this command in your terminal:
1 |
source ~/.zshrc |
For bash:
1 |
source ~/.bashrc |
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)!!!
Please, let me know if you have any questions in the comment section. Stay tuned for More!

- How to build your own Youtube – Part 10 - August 1, 2016
- How to build your own Youtube – Part 9 - July 25, 2016
- How to build your own Youtube – Part 8 - July 23, 2016
- How to build your own Youtube – Part 6 - July 6, 2016
- Introducing Laravel Password v1.0 - July 3, 2016
- How to build your own Youtube – Part 5 - June 28, 2016
- How to build your own Youtube – Part 4 - June 23, 2016
- How to build your own Youtube – Part 3 - June 15, 2016
- How to build your own Youtube – Part 2 - June 8, 2016
- How to build your own Youtube – Part 1 - June 1, 2016