2 .\" Title: git-annotate
3 .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
7 .\" Source: Git 2.42.0.rc0
10 .TH "GIT\-ANNOTATE" "1" "2023\-08\-04" "Git 2\&.42\&.0\&.rc0" "Git Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 git-annotate \- Annotate file lines with commit information
35 \fIgit annotate\fR [<options>] [<rev\-opts>] [<rev>] [\-\-] <file>
40 Annotates each line in the given file with information from the commit which introduced the line\&. Optionally annotates from a given revision\&.
42 The only difference between this command and \fBgit-blame\fR(1) is that they use slightly different output formats, and this command exists only for backward compatibility to support existing scripts, and provide a more familiar command name for people coming from other SCM systems\&.
47 Show blank SHA\-1 for boundary commits\&. This can also be controlled via the
48 \fBblame\&.blankBoundary\fR
54 Do not treat root commits as boundaries\&. This can also be controlled via the
55 \fBblame\&.showRoot\fR
61 Include additional statistics at the end of blame output\&.
64 \-L <start>,<end>, \-L :<funcname>
66 Annotate only the line range given by
67 \fI<start>,<end>\fR, or by the function name regex
68 \fI<funcname>\fR\&. May be specified multiple times\&. Overlapping ranges are allowed\&.
81 spans from start of file to
87 can take one of these forms:
103 is a number, it specifies an absolute line number (lines count from 1)\&.
116 This form will use the first line matching the given POSIX regex\&. If
118 is a regex, it will search from the end of the previous
120 range, if any, otherwise from the start of file\&. If
123 \fB^/regex/\fR, it will search from the start of file\&. If
125 is a regex, it will search starting at the line given by
139 This is only valid for
141 and will specify a number of lines before or after the line given by
150 \fI<end>\fR, it is a regular expression that denotes the range from the first funcname line that matches
151 \fI<funcname>\fR, up to the next funcname line\&.
153 searches from the end of the previous
155 range, if any, otherwise from the start of file\&.
157 searches from the start of file\&. The function names are determined in the same way as
159 works out patch hunk headers (see
160 \fIDefining a custom hunk\-header\fR
162 \fBgitattributes\fR(5))\&.
167 Show long rev (Default: off)\&.
172 Show raw timestamp (Default: off)\&.
177 Use revisions from revs\-file instead of calling
178 \fBgit-rev-list\fR(1)\&.
181 \-\-reverse <rev>\&.\&.<rev>
183 Walk history forward instead of backward\&. Instead of showing the revision in which a line appeared, this shows the last revision in which a line has existed\&. This requires a range of revision like START\&.\&.END where the path to blame exists in START\&.
184 \fBgit blame \-\-reverse START\fR
186 \fBgit blame \-\-reverse START\&.\&.HEAD\fR
192 Follow only the first parent commit upon seeing a merge commit\&. This option can be used to determine when a line was introduced to a particular integration branch, rather than when it was introduced to the history overall\&.
197 Show in a format designed for machine consumption\&.
202 Show the porcelain format, but output commit information for each line, not just the first time a commit is referenced\&. Implies \-\-porcelain\&.
207 Show the result incrementally in a format designed for machine consumption\&.
210 \-\-encoding=<encoding>
212 Specifies the encoding used to output author names and commit summaries\&. Setting it to
214 makes blame output unconverted data\&. For more information see the discussion about encoding in the
221 Annotate using the contents from the named file, starting from <rev> if it is specified, and HEAD otherwise\&. You may specify
223 to make the command read from the standard input for the file contents\&.
228 Specifies the format used to output dates\&. If \-\-date is not provided, the value of the blame\&.date config variable is used\&. If the blame\&.date config variable is also not set, the iso format is used\&. For supported values, see the discussion of the \-\-date option at
234 Progress status is reported on the standard error stream by default when it is attached to a terminal\&. This flag enables progress reporting even if not attached to a terminal\&. Can\(cqt use
239 \fB\-\-incremental\fR\&.
244 Detect moved or copied lines within a file\&. When a commit moves or copies a block of lines (e\&.g\&. the original file has A and then B, and the commit changes it to B and then A), the traditional
246 algorithm notices only half of the movement and typically blames the lines that were moved up (i\&.e\&. B) to the parent and assigns blame to the lines that were moved down (i\&.e\&. A) to the child commit\&. With this option, both groups of lines are blamed on the parent by running extra passes of inspection\&.
248 <num> is optional but it is the lower bound on the number of alphanumeric characters that Git must detect as moving/copying within a file for it to associate those lines with the parent commit\&. The default value is 20\&.
254 \fB\-M\fR, detect lines moved or copied from other files that were modified in the same commit\&. This is useful when you reorganize your program and move code around across files\&. When this option is given twice, the command additionally looks for copies from other files in the commit that creates the file\&. When this option is given three times, the command additionally looks for copies from other files in any commit\&.
256 <num> is optional but it is the lower bound on the number of alphanumeric characters that Git must detect as moving/copying between files for it to associate those lines with the parent commit\&. And the default value is 40\&. If there are more than one
258 options given, the <num> argument of the last
263 \-\-ignore\-rev <rev>
265 Ignore changes made by the revision when assigning blame, as if the change never happened\&. Lines that were changed or added by an ignored commit will be blamed on the previous commit that changed that line or nearby lines\&. This option may be specified multiple times to ignore more than one revision\&. If the
266 \fBblame\&.markIgnoredLines\fR
267 config option is set, then lines that were changed by an ignored commit and attributed to another commit will be marked with a
269 in the blame output\&. If the
270 \fBblame\&.markUnblamableLines\fR
271 config option is set, then those lines touched by an ignored commit that we could not attribute to another revision are marked with a
275 \-\-ignore\-revs\-file <file>
277 Ignore revisions listed in
278 \fBfile\fR, which must be in the same format as an
279 \fBfsck\&.skipList\fR\&. This option may be repeated, and these files will be processed after any files specified with the
280 \fBblame\&.ignoreRevsFile\fR
281 config option\&. An empty file name,
282 \fB""\fR, will clear the list of revs from previously processed files\&.
287 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
288 \fBcolor\&.blame\&.repeatedLines\fR
294 Color line annotations depending on the age of the line in the default format\&. The
295 \fBcolor\&.blame\&.highlightRecent\fR
296 config option controls what color is used for each range of age\&.
308 Part of the \fBgit\fR(1) suite