Skip to content

Commit 871e42e

Browse files
committed
Merge branch 'bs/doc-blame-color-lines'
The "--color-lines" and "--color-by-age" options of "git blame" have been missing, which are now documented. * bs/doc-blame-color-lines: blame: document --color-* options blame: describe default output format
2 parents a86ed75 + 8c32856 commit 871e42e

File tree

3 files changed

+44
-17
lines changed

3 files changed

+44
-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: 15 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
-----------
@@ -93,6 +93,19 @@ include::blame-options.txt[]
9393
is used for a caret to mark the boundary commit.
9494

9595

96+
THE DEFAULT FORMAT
97+
------------------
98+
99+
When neither `--porcelain` nor `--incremental` option is specified,
100+
`git blame` will output annotation for each line with:
101+
102+
- abbreviated object name for the commit the line came from;
103+
- author ident (by default author name and date, unless `-s` or `-e`
104+
is specified); and
105+
- line number
106+
107+
before the line contents.
108+
96109
THE PORCELAIN FORMAT
97110
--------------------
98111

0 commit comments

Comments
 (0)