I would like to setup git blame --color-by-age
as the default behavior whenever I invoke git blame
. How would I configure my .gitconfig
file to achieve this?
git config --global blame.coloring highlightRecent
From git-config(1):
blame.coloring
This determines the coloring scheme to be applied to blame output. It can be
repeatedLines
,highlightRecent
, ornone
which is the default.
and
color.blame.highlightRecent
This can be used to color the metadata of a blame line depending on age of the line.
This setting should be set to a comma-separated list of color and date settings, starting and ending with a color, the dates should be set from oldest to newest. The metadata will be colored given the colors if the the line was introduced before the given timestamp, overwriting older timestamped colors.
Instead of an absolute timestamp relative timestamps work as well, e.g.
2.weeks.ago
is valid to address anything older than 2 weeks.It defaults to
blue,12 month ago,white,1 month ago,red
, which colors everything older than one year blue, recent changes between one month and one year old are kept white, and lines introduced within the last month are colored red.