Search code examples
gitgit-log

A git log history graph with one line per commit, in color, with dates


I need to have format like:

git log --decorate --graph --oneline --date-order

but I need it also:

  1. to contain date (short)
  2. to have the same colors

I tried:

git log --decorate --graph --oneline --date-order \
--date=short --pretty=format:"%h %ad %s"

but it's harder to read (no colors) and does not include branches/tags


The closest simple solution is(thanks VonC):

git log --graph --pretty=format:'%C(yellow)%h%Creset \
-%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' \
--abbrev-commit --date=short

Solution

  • You can try:

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

    It has different color, but you can change them easily.

    for instance:

    git log --graph --pretty=format:'%Cred%h -%d %s (%cr) <%an>%Creset' --abbrev-commit --date=short --branches