git blame --color-by-age 在 git 配置中设置为默认值

git blame --color-by-age set as default in git config

我想将 git blame --color-by-age 设置为每次调用 git blame 时的默认行为。我将如何配置我的 .gitconfig 文件来实现此目的?

git config --global blame.coloring highlightRecent

来自git-config(1)

blame.coloring

This determines the coloring scheme to be applied to blame output. It can be repeatedLines, highlightRecent, or none which is the default.

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.