Chances are high when you happen to use a cool new command while working in linux or mac shell and you are not sure you will remember it next time. Usually those cool commands tend to be messy. How about checking the git log with the graph and branch names.
Now this may be alright with many people. But I usually forget/hate long commands (no matter how awesome they are) and what I usually end up doing is setting up an alias.
You can do that in two sets.
- Add "alias gl=git log --graph --oneline --decorate" to your ~/.bash_profile.
- Open a new terminal or refresh the current terminal with "source ~/.bash_profile"
Now thats a pain. Specially if you happen to find "cool commands" so often and you just have to stop what you do and do that two steps every time when you need to add an alias. And remember, setting up aliases can be highly addictive. You basically end up creating whole new your DSL sort of thing.
So I thought how nice it would be if I can setup an alias using a single command. The goal is to create a command which does both steps for you. When you in a terminal session, when you find out a cool new long command, you just call our new tool, it will add the new alias to .bash_profile and reset the current session all at once without we have to do anything, making our new command available instantly.
Introducing the command aset.
If my long cool command to see git log with graph is this >> git log --graph --oneline --decorate
I will set an alias to that exact command as gl
Thats it. The new command gl should be available right after we press enter.
To get aset from follow instructions in my github,
Or simple run this command in your shell. (tested in OS X)
Some aliases to start with. Please note that its fun and easy to add more and more.
Happy aliasing !!