Useful Git Alias and Hooks
Git by itself is very raw and sometime hard to read the console outputs. Following are some of git alias that I tend to use on a daily basis.
git lg
This is a replacement to git log. git log doesn't provide any useful information such as branch name nor it's pretty looking! Yes pretty looking like colors and such. Following git alias solves this mundane problem.Following is a comparison screenshot of git lg vs git log
Using git log:
Using git lg alias:
git unpushed
Every now and then I try to look for all uncommitted changes. But this quite a pain to look for from git console. Problem solved with the following alias:git undo
git out-of-the-box doesn't provide an undo option to revert the previous commit. Pain! Following alias intends to solve the problem:Pre-push hooks
One of the most important hooks that I use is a pre-push hook that executes unit tests before pushing to "master" branch. This is important as it can save broken test cases being pushed to master branch. Following hook script:Labels: Git
<< Home