Nicely formatted colored git log

Posted . Visible to the public.

I was struggle to set up a nicely formatted git log for a while. What I wanted to achive is to be able to quickly overlook the history including the
branch structure, authors, time of commits, remote and local branches. Here is what I currently use

I used to use this config in the past, there is little problem with this - honestly not too big -, is that all the branches displayed with yellow:

alias]
  prlog = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --abbrev-commit --date=short

I got a nice tip from a colleague, use %C(auto) and that way git will color the remote branches to red, locals to green.

so my current ~/.gitconfig looks like this:

[alias] 
  prlog = log --graph --pretty=format:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --abbrev-commit --date=short

Some links on the same subject:

Coderwall Show archive.org snapshot

Stackoverflow Show archive.org snapshot

Bonyiii
Last edit
Bonyiii
Posted by Bonyiii to Bonyiii's deck (2015-03-16 09:54)