Git tip: show current branch and time elapsed since last commit in command line

If you use git and have ever run into the frustrating situation of working for 2 hours on the wrong branch, then adding this code snippet - courtesy of Wen-Tien Chang (Twitter: @ihower) - to your ~/.bash_profile is for you:

With this trick, the command line will show the branch name, plus the time elapsed since last time you checked in the code. It reminds you that you should check in the code often and in small steps, which is good.
Also, you can have you "git checkout branch-name" to have sweet auto-completion for branch name by press "tab". Thanks, Wen-Tien Chang!

Post a Comment