Lately I’ve started to gravitate from GIT GUI’s tools to CLI.
What I missed was graphical representation of development of ehm… development.
However as with most popular open source tools , there’s solution for almost everything.
Simple
Just type in following command and enjoy. Well there are few downsides but it’s simple.
git log --graph -all
Most apparent downsides for some of us might be paging (git won’t finish / continue without user input in one go) and each commit taking multiple lines making even small three taking up multiple pages worth of lines.
Most options
if you prefer perfectly customized output you can in fact create formatted output by going all the way of adjusting all multiple little details.
git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
output
Obviously it’s not for free and you might end up with pretty long command line. You can however write it only once and then save it under global alias.
Best of both worlds
And at least solution which doesn’t need 4 full lines of code but also delivers quite attractive result. Best thing is, it can be modyfied
git log --pretty=format:"%h %cr %s" --graph --all
–pretty=format:”…” basically let’s you define table next to the “graphical” three.
Specifier | Description of Output |
---|---|
%H | Commit hash |
%h | Abbreviated commit hash |
%T | Tree hash |
%t | Abbreviated tree hash |
%P | Parent hashes |
%p | Abbreviated parent hashes |
%an | Author name |
%ae | Author email |
%ad | Author date (format respects the --date=option ) |
%ar | Author date, relative |
%cn | Committer name |
%ce | Committer email |
%cd | Committer date |
%cr | Committer date, relative |
%s | Subject |
Output
As you can see. You get quite pleasing output with minimal code.