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 given line range. May be specified multiple
34           times. Overlapping ranges are allowed.
35
36           <start> and <end> are optional.  “-L <start>” or “-L <start>,”
37           spans from <start> to end of file.  “-L ,<end>” spans from start of
38           file to <end>.
39
40           <start> and <end> can take one of these forms:
41
42           ·   number
43
44               If <start> or <end> is a number, it specifies an absolute line
45               number (lines count from 1).
46
47           ·   /regex/
48
49               This form will use the first line matching the given POSIX
50               regex. If <start> is a regex, it will search from the end of
51               the previous -L range, if any, otherwise from the start of
52               file. If <start> is “^/regex/”, it will search from the start
53               of file. If <end> is a regex, it will search starting at the
54               line given by <start>.
55
56           ·   +offset or -offset
57
58               This is only valid for <end> and will specify a number of lines
59               before or after the line given by <start>.
60
61           If “:<funcname>” is given in place of <start> and <end>, it is a
62           regular expression that denotes the range from the first funcname
63           line that matches <funcname>, up to the next funcname line.
64           “:<funcname>” searches from the end of the previous -L range, if
65           any, otherwise from the start of file.  “^:<funcname>” searches
66           from the start of file.
67
68       -l
69           Show long rev (Default: off).
70
71       -t
72           Show raw timestamp (Default: off).
73
74       -S <revs-file>
75           Use revisions from revs-file instead of calling git-rev-list(1).
76
77       --reverse <rev>..<rev>
78           Walk history forward instead of backward. Instead of showing the
79           revision in which a line appeared, this shows the last revision in
80           which a line has existed. This requires a range of revision like
81           START..END where the path to blame exists in START.  git blame
82           --reverse START is taken as git blame --reverse START..HEAD for
83           convenience.
84
85       -p, --porcelain
86           Show in a format designed for machine consumption.
87
88       --line-porcelain
89           Show the porcelain format, but output commit information for each
90           line, not just the first time a commit is referenced. Implies
91           --porcelain.
92
93       --incremental
94           Show the result incrementally in a format designed for machine
95           consumption.
96
97       --encoding=<encoding>
98           Specifies the encoding used to output author names and commit
99           summaries. Setting it to none makes blame output unconverted data.
100           For more information see the discussion about encoding in the git-
101           log(1) manual page.
102
103       --contents <file>
104           When <rev> is not specified, the command annotates the changes
105           starting backwards from the working tree copy. This flag makes the
106           command pretend as if the working tree copy has the contents of the
107           named file (specify - to make the command read from the standard
108           input).
109
110       --date <format>
111           Specifies the format used to output dates. If --date is not
112           provided, the value of the blame.date config variable is used. If
113           the blame.date config variable is also not set, the iso format is
114           used. For supported values, see the discussion of the --date option
115           at git-log(1).
116
117       --[no-]progress
118           Progress status is reported on the standard error stream by default
119           when it is attached to a terminal. This flag enables progress
120           reporting even if not attached to a terminal. Can’t use --progress
121           together with --porcelain or --incremental.
122
123       -M[<num>]
124           Detect moved or copied lines within a file. When a commit moves or
125           copies a block of lines (e.g. the original file has A and then B,
126           and the commit changes it to B and then A), the traditional blame
127           algorithm notices only half of the movement and typically blames
128           the lines that were moved up (i.e. B) to the parent and assigns
129           blame to the lines that were moved down (i.e. A) to the child
130           commit. With this option, both groups of lines are blamed on the
131           parent by running extra passes of inspection.
132
133           <num> is optional but it is the lower bound on the number of
134           alphanumeric characters that Git must detect as moving/copying
135           within a file for it to associate those lines with the parent
136           commit. The default value is 20.
137
138       -C[<num>]
139           In addition to -M, detect lines moved or copied from other files
140           that were modified in the same commit. This is useful when you
141           reorganize your program and move code around across files. When
142           this option is given twice, the command additionally looks for
143           copies from other files in the commit that creates the file. When
144           this option is given three times, the command additionally looks
145           for copies from other files in any commit.
146
147           <num> is optional but it is the lower bound on the number of
148           alphanumeric characters that Git must detect as moving/copying
149           between files for it to associate those lines with the parent
150           commit. And the default value is 40. If there are more than one -C
151           options given, the <num> argument of the last -C will take effect.
152
153       --ignore-rev <rev>
154           Ignore changes made by the revision when assigning blame, as if the
155           change never happened. Lines that were changed or added by an
156           ignored commit will be blamed on the previous commit that changed
157           that line or nearby lines. This option may be specified multiple
158           times to ignore more than one revision. If the
159           blame.markIgnoredLines config option is set, then lines that were
160           changed by an ignored commit and attributed to another commit will
161           be marked with a ?  in the blame output. If the
162           blame.markUnblamableLines config option is set, then those lines
163           touched by an ignored commit that we could not attribute to another
164           revision are marked with a *.
165
166       --ignore-revs-file <file>
167           Ignore revisions listed in file, which must be in the same format
168           as an fsck.skipList. This option may be repeated, and these files
169           will be processed after any files specified with the
170           blame.ignoreRevsFile config option. An empty file name, "", will
171           clear the list of revs from previously processed files.
172
173       -h
174           Show help message.
175

SEE ALSO

177       git-blame(1)
178

GIT

180       Part of the git(1) suite
181
182
183
184Git 2.26.2                        2020-04-20                   GIT-ANNOTATE(1)
Impressum