1GIT-ANNOTATE(1)                   Git Manual                   GIT-ANNOTATE(1)
2
3
4

NAME

6       git-annotate - Annotate file lines with commit information
7

SYNOPSIS

9       git annotate [<options>] <file> [<revision>]
10

DESCRIPTION

12       Annotates each line in the given file with information from the commit
13       which introduced the line. Optionally annotates from a given revision.
14
15       The only difference between this command and git-blame(1) is that they
16       use slightly different output formats, and this command exists only for
17       backward compatibility to support existing scripts, and provide a more
18       familiar command name for people coming from other SCM systems.
19

OPTIONS

21       -b
22           Show blank SHA-1 for boundary commits. This can also be controlled
23           via the blame.blankBoundary config option.
24
25       --root
26           Do not treat root commits as boundaries. This can also be
27           controlled via the blame.showRoot config option.
28
29       --show-stats
30           Include additional statistics at the end of blame output.
31
32       -L <start>,<end>, -L :<funcname>
33           Annotate only the line range given by <start>,<end>, or by the
34           function name regex <funcname>. May be specified multiple times.
35           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 to
39           <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 of
54               file. If <end> is a regex, it will search starting at the line
55               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 any,
66           otherwise from the start of file.  ^:<funcname> searches from the
67           start of file. The function names are determined in the same way as
68           git diff works out patch hunk headers (see Defining a custom
69           hunk-header in gitattributes(5)).
70
71       -l
72           Show long rev (Default: off).
73
74       -t
75           Show raw timestamp (Default: off).
76
77       -S <revs-file>
78           Use revisions from revs-file instead of calling git-rev-list(1).
79
80       --reverse <rev>..<rev>
81           Walk history forward instead of backward. Instead of showing the
82           revision in which a line appeared, this shows the last revision in
83           which a line has existed. This requires a range of revision like
84           START..END where the path to blame exists in START.  git blame
85           --reverse START is taken as git blame --reverse START..HEAD for
86           convenience.
87
88       --first-parent
89           Follow only the first parent commit upon seeing a merge commit.
90           This option can be used to determine when a line was introduced to
91           a particular integration branch, rather than when it was introduced
92           to the history overall.
93
94       -p, --porcelain
95           Show in a format designed for machine consumption.
96
97       --line-porcelain
98           Show the porcelain format, but output commit information for each
99           line, not just the first time a commit is referenced. Implies
100           --porcelain.
101
102       --incremental
103           Show the result incrementally in a format designed for machine
104           consumption.
105
106       --encoding=<encoding>
107           Specifies the encoding used to output author names and commit
108           summaries. Setting it to none makes blame output unconverted data.
109           For more information see the discussion about encoding in the git-
110           log(1) manual page.
111
112       --contents <file>
113           When <rev> is not specified, the command annotates the changes
114           starting backwards from the working tree copy. This flag makes the
115           command pretend as if the working tree copy has the contents of the
116           named file (specify - to make the command read from the standard
117           input).
118
119       --date <format>
120           Specifies the format used to output dates. If --date is not
121           provided, the value of the blame.date config variable is used. If
122           the blame.date config variable is also not set, the iso format is
123           used. For supported values, see the discussion of the --date option
124           at git-log(1).
125
126       --[no-]progress
127           Progress status is reported on the standard error stream by default
128           when it is attached to a terminal. This flag enables progress
129           reporting even if not attached to a terminal. Can’t use --progress
130           together with --porcelain or --incremental.
131
132       -M[<num>]
133           Detect moved or copied lines within a file. When a commit moves or
134           copies a block of lines (e.g. the original file has A and then B,
135           and the commit changes it to B and then A), the traditional blame
136           algorithm notices only half of the movement and typically blames
137           the lines that were moved up (i.e. B) to the parent and assigns
138           blame to the lines that were moved down (i.e. A) to the child
139           commit. With this option, both groups of lines are blamed on the
140           parent by running extra passes of inspection.
141
142           <num> is optional but it is the lower bound on the number of
143           alphanumeric characters that Git must detect as moving/copying
144           within a file for it to associate those lines with the parent
145           commit. The default value is 20.
146
147       -C[<num>]
148           In addition to -M, detect lines moved or copied from other files
149           that were modified in the same commit. This is useful when you
150           reorganize your program and move code around across files. When
151           this option is given twice, the command additionally looks for
152           copies from other files in the commit that creates the file. When
153           this option is given three times, the command additionally looks
154           for copies from other files in any commit.
155
156           <num> is optional but it is the lower bound on the number of
157           alphanumeric characters that Git must detect as moving/copying
158           between files for it to associate those lines with the parent
159           commit. And the default value is 40. If there are more than one -C
160           options given, the <num> argument of the last -C will take effect.
161
162       --ignore-rev <rev>
163           Ignore changes made by the revision when assigning blame, as if the
164           change never happened. Lines that were changed or added by an
165           ignored commit will be blamed on the previous commit that changed
166           that line or nearby lines. This option may be specified multiple
167           times to ignore more than one revision. If the
168           blame.markIgnoredLines config option is set, then lines that were
169           changed by an ignored commit and attributed to another commit will
170           be marked with a ?  in the blame output. If the
171           blame.markUnblamableLines config option is set, then those lines
172           touched by an ignored commit that we could not attribute to another
173           revision are marked with a *.
174
175       --ignore-revs-file <file>
176           Ignore revisions listed in file, which must be in the same format
177           as an fsck.skipList. This option may be repeated, and these files
178           will be processed after any files specified with the
179           blame.ignoreRevsFile config option. An empty file name, "", will
180           clear the list of revs from previously processed files.
181
182       -h
183           Show help message.
184

SEE ALSO

186       git-blame(1)
187

GIT

189       Part of the git(1) suite
190
191
192
193Git 2.31.1                        2021-03-26                   GIT-ANNOTATE(1)
Impressum