1GIT-ANNOTATE(1) Git Manual GIT-ANNOTATE(1)
2
3
4
6 git-annotate - Annotate file lines with commit information
7
9 git annotate [<options>] <file> [<revision>]
10
11
13 Annotates each line in the given file with information from the commit
14 which introduced the line. Optionally annotates from a given revision.
15
16 The only difference between this command and git-blame(1) is that they
17 use slightly different output formats, and this command exists only for
18 backward compatibility to support existing scripts, and provide a more
19 familiar command name for people coming from other SCM systems.
20
22 -b
23 Show blank SHA-1 for boundary commits. This can also be controlled
24 via the blame.blankboundary config option.
25
26 --root
27 Do not treat root commits as boundaries. This can also be
28 controlled via the blame.showRoot config option.
29
30 --show-stats
31 Include additional statistics at the end of blame output.
32
33 -L <start>,<end>, -L :<funcname>
34 Annotate only the given line range. May be specified multiple
35 times. Overlapping ranges are allowed.
36
37 <start> and <end> are optional. “-L <start>” or “-L <start>,” spans
38 from <start> to end of file. “-L ,<end>” spans from start of file
39 to <end>.
40
41 <start> and <end> can take one of these forms:
42
43 · number
44
45 If <start> or <end> is a number, it specifies an absolute line
46 number (lines count from 1).
47
48 · /regex/
49
50 This form will use the first line matching the given POSIX
51 regex. If <start> is a regex, it will search from the end of
52 the previous -L range, if any, otherwise from the start of
53 file. If <start> is “^/regex/”, it will search from the start
54 of file. If <end> is a regex, it will search starting at the
55 line given by <start>.
56
57 · +offset or -offset
58
59 This is only valid for <end> and will specify a number of lines
60 before or after the line given by <start>.
61
62 If “:<funcname>” is given in place of <start> and <end>, it is a
63 regular expression that denotes the range from the first funcname
64 line that matches <funcname>, up to the next funcname line.
65 “:<funcname>” searches from the end of the previous -L range, if
66 any, otherwise from the start of file. “^:<funcname>” searches from
67 the start of file.
68
69 -l
70 Show long rev (Default: off).
71
72 -t
73 Show raw timestamp (Default: off).
74
75 -S <revs-file>
76 Use revisions from revs-file instead of calling git-rev-list(1).
77
78 --reverse <rev>..<rev>
79 Walk history forward instead of backward. Instead of showing the
80 revision in which a line appeared, this shows the last revision in
81 which a line has existed. This requires a range of revision like
82 START..END where the path to blame exists in START. git blame
83 --reverse START is taken as git blame --reverse START..HEAD for
84 convenience.
85
86 -p, --porcelain
87 Show in a format designed for machine consumption.
88
89 --line-porcelain
90 Show the porcelain format, but output commit information for each
91 line, not just the first time a commit is referenced. Implies
92 --porcelain.
93
94 --incremental
95 Show the result incrementally in a format designed for machine
96 consumption.
97
98 --encoding=<encoding>
99 Specifies the encoding used to output author names and commit
100 summaries. Setting it to none makes blame output unconverted data.
101 For more information see the discussion about encoding in the git-
102 log(1) manual page.
103
104 --contents <file>
105 When <rev> is not specified, the command annotates the changes
106 starting backwards from the working tree copy. This flag makes the
107 command pretend as if the working tree copy has the contents of the
108 named file (specify - to make the command read from the standard
109 input).
110
111 --date <format>
112 Specifies the format used to output dates. If --date is not
113 provided, the value of the blame.date config variable is used. If
114 the blame.date config variable is also not set, the iso format is
115 used. For supported values, see the discussion of the --date option
116 at git-log(1).
117
118 --[no-]progress
119 Progress status is reported on the standard error stream by default
120 when it is attached to a terminal. This flag enables progress
121 reporting even if not attached to a terminal. Can’t use --progress
122 together with --porcelain or --incremental.
123
124 -M[<num>]
125 Detect moved or copied lines within a file. When a commit moves or
126 copies a block of lines (e.g. the original file has A and then B,
127 and the commit changes it to B and then A), the traditional blame
128 algorithm notices only half of the movement and typically blames
129 the lines that were moved up (i.e. B) to the parent and assigns
130 blame to the lines that were moved down (i.e. A) to the child
131 commit. With this option, both groups of lines are blamed on the
132 parent by running extra passes of inspection.
133
134 <num> is optional but it is the lower bound on the number of
135 alphanumeric characters that Git must detect as moving/copying
136 within a file for it to associate those lines with the parent
137 commit. The default value is 20.
138
139 -C[<num>]
140 In addition to -M, detect lines moved or copied from other files
141 that were modified in the same commit. This is useful when you
142 reorganize your program and move code around across files. When
143 this option is given twice, the command additionally looks for
144 copies from other files in the commit that creates the file. When
145 this option is given three times, the command additionally looks
146 for copies from other files in any commit.
147
148 <num> is optional but it is the lower bound on the number of
149 alphanumeric characters that Git must detect as moving/copying
150 between files for it to associate those lines with the parent
151 commit. And the default value is 40. If there are more than one -C
152 options given, the <num> argument of the last -C will take effect.
153
154 -h
155 Show help message.
156
158 git-blame(1)
159
161 Part of the git(1) suite
162
163
164
165Git 2.18.1 05/14/2019 GIT-ANNOTATE(1)