Thursday, October 18, 2012

Useful Git branch graphs

There's always the easy way of doing Git branch graphs in terminal by entering:
$ git log --graph --oneline --all

It's pretty useful, however here are a couple of excellent commands I came across on SO (thanks to user: Slipp Douglas ) which I use all the time and I thought I'd share them here..

log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white)— %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative

log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(bold white)— %an%C(reset)' --abbrev-commit

The first one is what I use very often since it shows the author and more importantly how long ago a commit was made. So I can very quickly just scan the "how long ago" section to identify any recently made changes without having to read dates and make sense of them

However, in some cases when you do need the dates, the second command specifies the entire date and time too but it spans on 2 lines instead of just 1. Very useful nevertheless.


No comments:

Post a Comment

Popular Posts