1

I have configured custom git alias that I use very frequently to see the complete graph and commit summary.

[alias]
    graph = log --oneline --all --decorate --graph

One thing I would like to add to this alias is the author name. I am trying to add it using the following format option configuration

git log --oneline --all --decorate --graph --format=format:"%h%x09%d%x09%an%x09%s"

This command seems to work but I do not get the nice color coding for commit hash and branch names. Can anyone please guide me as to how can I retain the color highlight for branch names and commit hashes?

jub0bs
  • 60,866
  • 25
  • 183
  • 186
Afraz Ali
  • 2,672
  • 2
  • 27
  • 47

1 Answers1

2

Just add the color code %C(auto) in front of your format string :

git log --all --decorate --graph --format=format:"%C(auto)%h%x09%d%x09%an%x09%s"

However, the author name is not colored by default, so you'll need a specific color code in front of it, like

git log --all --decorate --graph --format=format:"%C(auto)%h%x09%d%x09%C(blue)%an%C(reset)%x09%s"
Romain Valeri
  • 19,645
  • 3
  • 36
  • 61