blame: document --color-* options

Commit cdc2d5f11f (builtin/blame: dim uninteresting metadata lines,
2018-04-23) and 25d5f52901 (builtin/blame: highlight recently changed
lines, 2018-04-23) introduce --color-lines and --color-by-age options to
git blame, respectively. While both options are mentioned in usage help,
they aren't documented in git-blame(1). Document them.

Co-authored-by: Dr. Matthias St. Pierre <m.st.pierre@ncp-e.com>
Signed-off-by: Dr. Matthias St. Pierre <m.st.pierre@ncp-e.com>
Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Bagas Sanjaya 2021-10-08 16:16:14 +07:00 committed by Junio C Hamano
parent 38c356aad6
commit 8c32856133
3 changed files with 31 additions and 17 deletions

View File

@ -136,5 +136,16 @@ take effect.
option. An empty file name, `""`, will clear the list of revs from option. An empty file name, `""`, will clear the list of revs from
previously processed files. previously processed files.
--color-lines::
Color line annotations in the default format differently if they come from
the same commit as the preceding line. This makes it easier to distinguish
code blocks introduced by different commits. The color defaults to cyan and
can be adjusted using the `color.blame.repeatedLines` config option.
--color-by-age::
Color line annotations depending on the age of the line in the default format.
The `color.blame.highlightRecent` config option controls what color is used for
each range of age.
-h:: -h::
Show help message. Show help message.

View File

@ -9,26 +9,29 @@ color.advice.hint::
Use customized color for hints. Use customized color for hints.
color.blame.highlightRecent:: color.blame.highlightRecent::
This can be used to color the metadata of a blame line depending Specify the line annotation color for `git blame --color-by-age`
on age of the line. depending upon the age of the line.
+ +
This setting should be set to a comma-separated list of color and date settings, This setting should be set to a comma-separated list of color and
starting and ending with a color, the dates should be set from oldest to newest. date settings, starting and ending with a color, the dates should be
The metadata will be colored given the colors if the line was introduced set from oldest to newest. The metadata will be colored with the
before the given timestamp, overwriting older timestamped colors. specified colors if the line was introduced before the given
timestamp, overwriting older timestamped colors.
+ +
Instead of an absolute timestamp relative timestamps work as well, e.g. Instead of an absolute timestamp relative timestamps work as well,
2.weeks.ago is valid to address anything older than 2 weeks. 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 It defaults to `blue,12 month ago,white,1 month ago,red`, which
everything older than one year blue, recent changes between one month and colors everything older than one year blue, recent changes between
one year old are kept white, and lines introduced within the last month are one month and one year old are kept white, and lines introduced
colored red. within the last month are colored red.
color.blame.repeatedLines:: color.blame.repeatedLines::
Use the customized color for the part of git-blame output that Use the specified color to colorize line annotations for
is repeated meta information per line (such as commit id, `git blame --color-lines`, if they come from the same commit as the
author name, date and timezone). Defaults to cyan. preceding line. Defaults to cyan.
color.branch:: color.branch::
A boolean to enable/disable color in the output of A boolean to enable/disable color in the output of

View File

@ -11,8 +11,8 @@ SYNOPSIS
'git blame' [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-e] [-p] [-w] [--incremental] 'git blame' [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-e] [-p] [-w] [--incremental]
[-L <range>] [-S <revs-file>] [-M] [-C] [-C] [-C] [--since=<date>] [-L <range>] [-S <revs-file>] [-M] [-C] [-C] [-C] [--since=<date>]
[--ignore-rev <rev>] [--ignore-revs-file <file>] [--ignore-rev <rev>] [--ignore-revs-file <file>]
[--progress] [--abbrev=<n>] [<rev> | --contents <file> | --reverse <rev>..<rev>] [--color-lines] [--color-by-age] [--progress] [--abbrev=<n>]
[--] <file> [<rev> | --contents <file> | --reverse <rev>..<rev>] [--] <file>
DESCRIPTION DESCRIPTION
----------- -----------