Skip to content

Commit 8c32856

Browse files
bagasmeDr. Matthias St. Pierre
authored andcommitted
blame: document --color-* options
Commit cdc2d5f (builtin/blame: dim uninteresting metadata lines, 2018-04-23) and 25d5f52 (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 <[email protected]> Signed-off-by: Dr. Matthias St. Pierre <[email protected]> Signed-off-by: Bagas Sanjaya <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 38c356a commit 8c32856

File tree

3 files changed

+31
-17
lines changed

3 files changed

+31
-17
lines changed

Documentation/blame-options.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,16 @@ take effect.
136136
option. An empty file name, `""`, will clear the list of revs from
137137
previously processed files.
138138

139+
--color-lines::
140+
Color line annotations in the default format differently if they come from
141+
the same commit as the preceding line. This makes it easier to distinguish
142+
code blocks introduced by different commits. The color defaults to cyan and
143+
can be adjusted using the `color.blame.repeatedLines` config option.
144+
145+
--color-by-age::
146+
Color line annotations depending on the age of the line in the default format.
147+
The `color.blame.highlightRecent` config option controls what color is used for
148+
each range of age.
149+
139150
-h::
140151
Show help message.

Documentation/config/color.txt

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,29 @@ color.advice.hint::
99
Use customized color for hints.
1010

1111
color.blame.highlightRecent::
12-
This can be used to color the metadata of a blame line depending
13-
on age of the line.
12+
Specify the line annotation color for `git blame --color-by-age`
13+
depending upon the age of the line.
1414
+
15-
This setting should be set to a comma-separated list of color and date settings,
16-
starting and ending with a color, the dates should be set from oldest to newest.
17-
The metadata will be colored given the colors if the line was introduced
18-
before the given timestamp, overwriting older timestamped colors.
15+
This setting should be set to a comma-separated list of color and
16+
date settings, starting and ending with a color, the dates should be
17+
set from oldest to newest. The metadata will be colored with the
18+
specified colors if the line was introduced before the given
19+
timestamp, overwriting older timestamped colors.
20+
1921
+
20-
Instead of an absolute timestamp relative timestamps work as well, e.g.
21-
2.weeks.ago is valid to address anything older than 2 weeks.
22+
Instead of an absolute timestamp relative timestamps work as well,
23+
e.g. `2.weeks.ago` is valid to address anything older than 2 weeks.
24+
2225
+
23-
It defaults to 'blue,12 month ago,white,1 month ago,red', which colors
24-
everything older than one year blue, recent changes between one month and
25-
one year old are kept white, and lines introduced within the last month are
26-
colored red.
26+
It defaults to `blue,12 month ago,white,1 month ago,red`, which
27+
colors everything older than one year blue, recent changes between
28+
one month and one year old are kept white, and lines introduced
29+
within the last month are colored red.
2730

2831
color.blame.repeatedLines::
29-
Use the customized color for the part of git-blame output that
30-
is repeated meta information per line (such as commit id,
31-
author name, date and timezone). Defaults to cyan.
32+
Use the specified color to colorize line annotations for
33+
`git blame --color-lines`, if they come from the same commit as the
34+
preceding line. Defaults to cyan.
3235

3336
color.branch::
3437
A boolean to enable/disable color in the output of

Documentation/git-blame.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ SYNOPSIS
1111
'git blame' [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-e] [-p] [-w] [--incremental]
1212
[-L <range>] [-S <revs-file>] [-M] [-C] [-C] [-C] [--since=<date>]
1313
[--ignore-rev <rev>] [--ignore-revs-file <file>]
14-
[--progress] [--abbrev=<n>] [<rev> | --contents <file> | --reverse <rev>..<rev>]
15-
[--] <file>
14+
[--color-lines] [--color-by-age] [--progress] [--abbrev=<n>]
15+
[<rev> | --contents <file> | --reverse <rev>..<rev>] [--] <file>
1616

1717
DESCRIPTION
1818
-----------

0 commit comments

Comments
 (0)