2 .\" Title: git-annotate
3 .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
4 .\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/>
7 .\" Source: Git 2.47.0.rc0.18.ge9356ba3ea
10 .TH "GIT\-ANNOTATE" "1" "2024-09-30" "Git 2\&.47\&.0\&.rc0\&.18\&.ge" "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>
39 Annotates each line in the given file with information from the commit which introduced the line\&. Optionally annotates from a given revision\&.
41 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\&.
46 Show blank SHA\-1 for boundary commits\&. This can also be controlled via the
47 \fBblame\&.blankBoundary\fR
53 Do not treat root commits as boundaries\&. This can also be controlled via the
54 \fBblame\&.showRoot\fR
60 Include additional statistics at the end of blame output\&.
63 \-L <start>,<end>, \-L :<funcname>
65 Annotate only the line range given by
66 \fI<start>,<end>\fR, or by the function name regex
67 \fI<funcname>\fR\&. May be specified multiple times\&. Overlapping ranges are allowed\&.
80 spans from start of file to
86 can take one of these forms:
102 is a number, it specifies an absolute line number (lines count from 1)\&.
115 This form will use the first line matching the given POSIX regex\&. If
117 is a regex, it will search from the end of the previous
119 range, if any, otherwise from the start of file\&. If
122 \fB^/regex/\fR, it will search from the start of file\&. If
124 is a regex, it will search starting at the line given by
138 This is only valid for
140 and will specify a number of lines before or after the line given by
149 \fI<end>\fR, it is a regular expression that denotes the range from the first funcname line that matches
150 \fI<funcname>\fR, up to the next funcname line\&.
152 searches from the end of the previous
154 range, if any, otherwise from the start of file\&.
156 searches from the start of file\&. The function names are determined in the same way as
158 works out patch hunk headers (see
159 \fIDefining a custom hunk\-header\fR
161 \fBgitattributes\fR(5))\&.
166 Show long rev (Default: off)\&.
171 Show raw timestamp (Default: off)\&.
176 Use revisions from revs\-file instead of calling
177 \fBgit-rev-list\fR(1)\&.
180 \-\-reverse <rev>\&.\&.<rev>
182 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\&.
183 \fBgit blame \-\-reverse START\fR
185 \fBgit blame \-\-reverse START\&.\&.HEAD\fR
191 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\&.
196 Show in a format designed for machine consumption\&.
201 Show the porcelain format, but output commit information for each line, not just the first time a commit is referenced\&. Implies \-\-porcelain\&.
206 Show the result incrementally in a format designed for machine consumption\&.
209 \-\-encoding=<encoding>
211 Specifies the encoding used to output author names and commit summaries\&. Setting it to
213 makes blame output unconverted data\&. For more information see the discussion about encoding in the
220 Annotate using the contents from the named file, starting from <rev> if it is specified, and HEAD otherwise\&. You may specify
222 to make the command read from the standard input for the file contents\&.
227 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
233 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
238 \fB\-\-incremental\fR\&.
243 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
245 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\&.
247 <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\&.
253 \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\&.
255 <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
257 options given, the <num> argument of the last
262 \-\-ignore\-rev <rev>
264 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
265 \fBblame\&.markIgnoredLines\fR
266 config option is set, then lines that were changed by an ignored commit and attributed to another commit will be marked with a
268 in the blame output\&. If the
269 \fBblame\&.markUnblamableLines\fR
270 config option is set, then those lines touched by an ignored commit that we could not attribute to another revision are marked with a
274 \-\-ignore\-revs\-file <file>
276 Ignore revisions listed in
277 \fBfile\fR, which must be in the same format as an
278 \fBfsck\&.skipList\fR\&. This option may be repeated, and these files will be processed after any files specified with the
279 \fBblame\&.ignoreRevsFile\fR
280 config option\&. An empty file name,
281 \fB""\fR, will clear the list of revs from previously processed files\&.
286 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
287 \fBcolor\&.blame\&.repeatedLines\fR
293 Color line annotations depending on the age of the line in the default format\&. The
294 \fBcolor\&.blame\&.highlightRecent\fR
295 config option controls what color is used for each range of age\&.
307 Part of the \fBgit\fR(1) suite