Since Git is awesome. It also provides functionality of making aliases.
git config --global alias.co checkout
Here we created co as an alias for checkout (All the aliases that are created goes into .gitconfig file under home folder). Now to checkout a branch named testBranch, We can also write
git co testBranch Switched to branch 'testBranch'
Here are couple of interesting git aliases that we can make
1.git config –global alias.undo ‘reset –hard’
Now if we write “git undo” then any of changes after my last commit will be removed.
2.git config –global alias.cleanup = ! git fsck && git prune && git gc
In this Command we have used exclamation mark (!), this indicates that these commands would be running on terminal.
And in git if I want multiple command to be running one after another we use double ampersand (&&) (We cannot use semicolon as we would usually do in terminal).
This command will run git fsck (file check), git prune (to clean dangling commits/blobs) and git garage collection
Number of git alias that can be made are endless all it needs is little creativity.