1GIT-LOG(1) Git Manual GIT-LOG(1)
2
3
4
6 git-log - Show commit logs
7
9 git log [<options>] [<revision-range>] [[--] <path>...]
10
12 Shows the commit logs.
13
14 List commits that are reachable by following the parent links from the
15 given commit(s), but exclude commits that are reachable from the one(s)
16 given with a ^ in front of them. The output is given in reverse
17 chronological order by default.
18
19 You can think of this as a set operation. Commits reachable from any of
20 the commits given on the command line form a set, and then commits
21 reachable from any of the ones given with ^ in front are subtracted
22 from that set. The remaining commits are what comes out in the
23 command’s output. Various other options and paths parameters can be
24 used to further limit the result.
25
26 Thus, the following command:
27
28 $ git log foo bar ^baz
29
30 means "list all the commits which are reachable from foo or bar, but
31 not from baz".
32
33 A special notation "<commit1>..<commit2>" can be used as a short-hand
34 for "^<commit1> <commit2>". For example, either of the following may be
35 used interchangeably:
36
37 $ git log origin..HEAD
38 $ git log HEAD ^origin
39
40 Another special notation is "<commit1>...<commit2>" which is useful for
41 merges. The resulting set of commits is the symmetric difference
42 between the two operands. The following two commands are equivalent:
43
44 $ git log A B --not $(git merge-base --all A B)
45 $ git log A...B
46
47 The command takes options applicable to the git-rev-list(1) command to
48 control what is shown and how, and options applicable to the git-
49 diff(1) command to control how the changes each commit introduces are
50 shown.
51
53 --follow
54 Continue listing the history of a file beyond renames (works only
55 for a single file).
56
57 --no-decorate, --decorate[=short|full|auto|no]
58 Print out the ref names of any commits that are shown. If short is
59 specified, the ref name prefixes refs/heads/, refs/tags/ and
60 refs/remotes/ will not be printed. If full is specified, the full
61 ref name (including prefix) will be printed. If auto is specified,
62 then if the output is going to a terminal, the ref names are shown
63 as if short were given, otherwise no ref names are shown. The
64 option --decorate is short-hand for --decorate=short. Default to
65 configuration value of log.decorate if configured, otherwise, auto.
66
67 --decorate-refs=<pattern>, --decorate-refs-exclude=<pattern>
68 If no --decorate-refs is given, pretend as if all refs were
69 included. For each candidate, do not use it for decoration if it
70 matches any patterns given to --decorate-refs-exclude or if it
71 doesn’t match any of the patterns given to --decorate-refs. The
72 log.excludeDecoration config option allows excluding refs from the
73 decorations, but an explicit --decorate-refs pattern will override
74 a match in log.excludeDecoration.
75
76 --source
77 Print out the ref name given on the command line by which each
78 commit was reached.
79
80 --[no-]mailmap, --[no-]use-mailmap
81 Use mailmap file to map author and committer names and email
82 addresses to canonical real names and email addresses. See git-
83 shortlog(1).
84
85 --full-diff
86 Without this flag, git log -p <path>... shows commits that touch
87 the specified paths, and diffs about the same specified paths. With
88 this, the full diff is shown for commits that touch the specified
89 paths; this means that "<path>..." limits only commits, and doesn’t
90 limit diff for those commits.
91
92 Note that this affects all diff-based output types, e.g. those
93 produced by --stat, etc.
94
95 --log-size
96 Include a line “log size <number>” in the output for each commit,
97 where <number> is the length of that commit’s message in bytes.
98 Intended to speed up tools that read log messages from git log
99 output by allowing them to allocate space in advance.
100
101 -L<start>,<end>:<file>, -L:<funcname>:<file>
102 Trace the evolution of the line range given by <start>,<end>, or by
103 the function name regex <funcname>, within the <file>. You may not
104 give any pathspec limiters. This is currently limited to a walk
105 starting from a single revision, i.e., you may only give zero or
106 one positive revision arguments, and <start> and <end> (or
107 <funcname>) must exist in the starting revision. You can specify
108 this option more than once. Implies --patch. Patch output can be
109 suppressed using --no-patch, but other diff formats (namely --raw,
110 --numstat, --shortstat, --dirstat, --summary, --name-only,
111 --name-status, --check) are not currently implemented.
112
113 <start> and <end> can take one of these forms:
114
115 • number
116
117 If <start> or <end> is a number, it specifies an absolute line
118 number (lines count from 1).
119
120 • /regex/
121
122 This form will use the first line matching the given POSIX
123 regex. If <start> is a regex, it will search from the end of
124 the previous -L range, if any, otherwise from the start of
125 file. If <start> is ^/regex/, it will search from the start of
126 file. If <end> is a regex, it will search starting at the line
127 given by <start>.
128
129 • +offset or -offset
130
131 This is only valid for <end> and will specify a number of lines
132 before or after the line given by <start>.
133
134 If :<funcname> is given in place of <start> and <end>, it is a
135 regular expression that denotes the range from the first funcname
136 line that matches <funcname>, up to the next funcname line.
137 :<funcname> searches from the end of the previous -L range, if any,
138 otherwise from the start of file. ^:<funcname> searches from the
139 start of file. The function names are determined in the same way as
140 git diff works out patch hunk headers (see Defining a custom
141 hunk-header in gitattributes(5)).
142
143 <revision-range>
144 Show only commits in the specified revision range. When no
145 <revision-range> is specified, it defaults to HEAD (i.e. the whole
146 history leading to the current commit). origin..HEAD specifies all
147 the commits reachable from the current commit (i.e. HEAD), but not
148 from origin. For a complete list of ways to spell <revision-range>,
149 see the Specifying Ranges section of gitrevisions(7).
150
151 [--] <path>...
152 Show only commits that are enough to explain how the files that
153 match the specified paths came to be. See History Simplification
154 below for details and other simplification modes.
155
156 Paths may need to be prefixed with -- to separate them from options
157 or the revision range, when confusion arises.
158
159 Commit Limiting
160 Besides specifying a range of commits that should be listed using the
161 special notations explained in the description, additional commit
162 limiting may be applied.
163
164 Using more options generally further limits the output (e.g.
165 --since=<date1> limits to commits newer than <date1>, and using it with
166 --grep=<pattern> further limits to commits whose log message has a line
167 that matches <pattern>), unless otherwise noted.
168
169 Note that these are applied before commit ordering and formatting
170 options, such as --reverse.
171
172 -<number>, -n <number>, --max-count=<number>
173 Limit the number of commits to output.
174
175 --skip=<number>
176 Skip number commits before starting to show the commit output.
177
178 --since=<date>, --after=<date>
179 Show commits more recent than a specific date.
180
181 --until=<date>, --before=<date>
182 Show commits older than a specific date.
183
184 --author=<pattern>, --committer=<pattern>
185 Limit the commits output to ones with author/committer header lines
186 that match the specified pattern (regular expression). With more
187 than one --author=<pattern>, commits whose author matches any of
188 the given patterns are chosen (similarly for multiple
189 --committer=<pattern>).
190
191 --grep-reflog=<pattern>
192 Limit the commits output to ones with reflog entries that match the
193 specified pattern (regular expression). With more than one
194 --grep-reflog, commits whose reflog message matches any of the
195 given patterns are chosen. It is an error to use this option unless
196 --walk-reflogs is in use.
197
198 --grep=<pattern>
199 Limit the commits output to ones with log message that matches the
200 specified pattern (regular expression). With more than one
201 --grep=<pattern>, commits whose message matches any of the given
202 patterns are chosen (but see --all-match).
203
204 When --notes is in effect, the message from the notes is matched as
205 if it were part of the log message.
206
207 --all-match
208 Limit the commits output to ones that match all given --grep,
209 instead of ones that match at least one.
210
211 --invert-grep
212 Limit the commits output to ones with log message that do not match
213 the pattern specified with --grep=<pattern>.
214
215 -i, --regexp-ignore-case
216 Match the regular expression limiting patterns without regard to
217 letter case.
218
219 --basic-regexp
220 Consider the limiting patterns to be basic regular expressions;
221 this is the default.
222
223 -E, --extended-regexp
224 Consider the limiting patterns to be extended regular expressions
225 instead of the default basic regular expressions.
226
227 -F, --fixed-strings
228 Consider the limiting patterns to be fixed strings (don’t interpret
229 pattern as a regular expression).
230
231 -P, --perl-regexp
232 Consider the limiting patterns to be Perl-compatible regular
233 expressions.
234
235 Support for these types of regular expressions is an optional
236 compile-time dependency. If Git wasn’t compiled with support for
237 them providing this option will cause it to die.
238
239 --remove-empty
240 Stop when a given path disappears from the tree.
241
242 --merges
243 Print only merge commits. This is exactly the same as
244 --min-parents=2.
245
246 --no-merges
247 Do not print commits with more than one parent. This is exactly the
248 same as --max-parents=1.
249
250 --min-parents=<number>, --max-parents=<number>, --no-min-parents,
251 --no-max-parents
252 Show only commits which have at least (or at most) that many parent
253 commits. In particular, --max-parents=1 is the same as --no-merges,
254 --min-parents=2 is the same as --merges. --max-parents=0 gives all
255 root commits and --min-parents=3 all octopus merges.
256
257 --no-min-parents and --no-max-parents reset these limits (to no
258 limit) again. Equivalent forms are --min-parents=0 (any commit has
259 0 or more parents) and --max-parents=-1 (negative numbers denote no
260 upper limit).
261
262 --first-parent
263 When finding commits to include, follow only the first parent
264 commit upon seeing a merge commit. This option can give a better
265 overview when viewing the evolution of a particular topic branch,
266 because merges into a topic branch tend to be only about adjusting
267 to updated upstream from time to time, and this option allows you
268 to ignore the individual commits brought in to your history by such
269 a merge.
270
271 This option also changes default diff format for merge commits to
272 first-parent, see --diff-merges=first-parent for details.
273
274 --exclude-first-parent-only
275 When finding commits to exclude (with a ^), follow only the first
276 parent commit upon seeing a merge commit. This can be used to find
277 the set of changes in a topic branch from the point where it
278 diverged from the remote branch, given that arbitrary merges can be
279 valid topic branch changes.
280
281 --not
282 Reverses the meaning of the ^ prefix (or lack thereof) for all
283 following revision specifiers, up to the next --not.
284
285 --all
286 Pretend as if all the refs in refs/, along with HEAD, are listed on
287 the command line as <commit>.
288
289 --branches[=<pattern>]
290 Pretend as if all the refs in refs/heads are listed on the command
291 line as <commit>. If <pattern> is given, limit branches to ones
292 matching given shell glob. If pattern lacks ?, *, or [, /* at the
293 end is implied.
294
295 --tags[=<pattern>]
296 Pretend as if all the refs in refs/tags are listed on the command
297 line as <commit>. If <pattern> is given, limit tags to ones
298 matching given shell glob. If pattern lacks ?, *, or [, /* at the
299 end is implied.
300
301 --remotes[=<pattern>]
302 Pretend as if all the refs in refs/remotes are listed on the
303 command line as <commit>. If <pattern> is given, limit
304 remote-tracking branches to ones matching given shell glob. If
305 pattern lacks ?, *, or [, /* at the end is implied.
306
307 --glob=<glob-pattern>
308 Pretend as if all the refs matching shell glob <glob-pattern> are
309 listed on the command line as <commit>. Leading refs/, is
310 automatically prepended if missing. If pattern lacks ?, *, or [, /*
311 at the end is implied.
312
313 --exclude=<glob-pattern>
314 Do not include refs matching <glob-pattern> that the next --all,
315 --branches, --tags, --remotes, or --glob would otherwise consider.
316 Repetitions of this option accumulate exclusion patterns up to the
317 next --all, --branches, --tags, --remotes, or --glob option (other
318 options or arguments do not clear accumulated patterns).
319
320 The patterns given should not begin with refs/heads, refs/tags, or
321 refs/remotes when applied to --branches, --tags, or --remotes,
322 respectively, and they must begin with refs/ when applied to --glob
323 or --all. If a trailing /* is intended, it must be given
324 explicitly.
325
326 --reflog
327 Pretend as if all objects mentioned by reflogs are listed on the
328 command line as <commit>.
329
330 --alternate-refs
331 Pretend as if all objects mentioned as ref tips of alternate
332 repositories were listed on the command line. An alternate
333 repository is any repository whose object directory is specified in
334 objects/info/alternates. The set of included objects may be
335 modified by core.alternateRefsCommand, etc. See git-config(1).
336
337 --single-worktree
338 By default, all working trees will be examined by the following
339 options when there are more than one (see git-worktree(1)): --all,
340 --reflog and --indexed-objects. This option forces them to examine
341 the current working tree only.
342
343 --ignore-missing
344 Upon seeing an invalid object name in the input, pretend as if the
345 bad input was not given.
346
347 --bisect
348 Pretend as if the bad bisection ref refs/bisect/bad was listed and
349 as if it was followed by --not and the good bisection refs
350 refs/bisect/good-* on the command line.
351
352 --stdin
353 In addition to the <commit> listed on the command line, read them
354 from the standard input. If a -- separator is seen, stop reading
355 commits and start reading paths to limit the result.
356
357 --cherry-mark
358 Like --cherry-pick (see below) but mark equivalent commits with =
359 rather than omitting them, and inequivalent ones with +.
360
361 --cherry-pick
362 Omit any commit that introduces the same change as another commit
363 on the “other side” when the set of commits are limited with
364 symmetric difference.
365
366 For example, if you have two branches, A and B, a usual way to list
367 all commits on only one side of them is with --left-right (see the
368 example below in the description of the --left-right option).
369 However, it shows the commits that were cherry-picked from the
370 other branch (for example, “3rd on b” may be cherry-picked from
371 branch A). With this option, such pairs of commits are excluded
372 from the output.
373
374 --left-only, --right-only
375 List only commits on the respective side of a symmetric difference,
376 i.e. only those which would be marked < resp. > by --left-right.
377
378 For example, --cherry-pick --right-only A...B omits those commits
379 from B which are in A or are patch-equivalent to a commit in A. In
380 other words, this lists the + commits from git cherry A B. More
381 precisely, --cherry-pick --right-only --no-merges gives the exact
382 list.
383
384 --cherry
385 A synonym for --right-only --cherry-mark --no-merges; useful to
386 limit the output to the commits on our side and mark those that
387 have been applied to the other side of a forked history with git
388 log --cherry upstream...mybranch, similar to git cherry upstream
389 mybranch.
390
391 -g, --walk-reflogs
392 Instead of walking the commit ancestry chain, walk reflog entries
393 from the most recent one to older ones. When this option is used
394 you cannot specify commits to exclude (that is, ^commit,
395 commit1..commit2, and commit1...commit2 notations cannot be used).
396
397 With --pretty format other than oneline and reference (for obvious
398 reasons), this causes the output to have two extra lines of
399 information taken from the reflog. The reflog designator in the
400 output may be shown as ref@{Nth} (where Nth is the
401 reverse-chronological index in the reflog) or as ref@{timestamp}
402 (with the timestamp for that entry), depending on a few rules:
403
404 1. If the starting point is specified as ref@{Nth}, show the index
405 format.
406
407 2. If the starting point was specified as ref@{now}, show the
408 timestamp format.
409
410 3. If neither was used, but --date was given on the command line,
411 show the timestamp in the format requested by --date.
412
413 4. Otherwise, show the index format.
414
415 Under --pretty=oneline, the commit message is prefixed with this
416 information on the same line. This option cannot be combined with
417 --reverse. See also git-reflog(1).
418
419 Under --pretty=reference, this information will not be shown at
420 all.
421
422 --merge
423 After a failed merge, show refs that touch files having a conflict
424 and don’t exist on all heads to merge.
425
426 --boundary
427 Output excluded boundary commits. Boundary commits are prefixed
428 with -.
429
430 History Simplification
431 Sometimes you are only interested in parts of the history, for example
432 the commits modifying a particular <path>. But there are two parts of
433 History Simplification, one part is selecting the commits and the other
434 is how to do it, as there are various strategies to simplify the
435 history.
436
437 The following options select the commits to be shown:
438
439 <paths>
440 Commits modifying the given <paths> are selected.
441
442 --simplify-by-decoration
443 Commits that are referred by some branch or tag are selected.
444
445 Note that extra commits can be shown to give a meaningful history.
446
447 The following options affect the way the simplification is performed:
448
449 Default mode
450 Simplifies the history to the simplest history explaining the final
451 state of the tree. Simplest because it prunes some side branches if
452 the end result is the same (i.e. merging branches with the same
453 content)
454
455 --show-pulls
456 Include all commits from the default mode, but also any merge
457 commits that are not TREESAME to the first parent but are TREESAME
458 to a later parent. This mode is helpful for showing the merge
459 commits that "first introduced" a change to a branch.
460
461 --full-history
462 Same as the default mode, but does not prune some history.
463
464 --dense
465 Only the selected commits are shown, plus some to have a meaningful
466 history.
467
468 --sparse
469 All commits in the simplified history are shown.
470
471 --simplify-merges
472 Additional option to --full-history to remove some needless merges
473 from the resulting history, as there are no selected commits
474 contributing to this merge.
475
476 --ancestry-path
477 When given a range of commits to display (e.g. commit1..commit2 or
478 commit2 ^commit1), only display commits that exist directly on the
479 ancestry chain between the commit1 and commit2, i.e. commits that
480 are both descendants of commit1, and ancestors of commit2.
481
482 A more detailed explanation follows.
483
484 Suppose you specified foo as the <paths>. We shall call commits that
485 modify foo !TREESAME, and the rest TREESAME. (In a diff filtered for
486 foo, they look different and equal, respectively.)
487
488 In the following, we will always refer to the same example history to
489 illustrate the differences between simplification settings. We assume
490 that you are filtering for a file foo in this commit graph:
491
492 .-A---M---N---O---P---Q
493 / / / / / /
494 I B C D E Y
495 \ / / / / /
496 `-------------' X
497
498 The horizontal line of history A---Q is taken to be the first parent of
499 each merge. The commits are:
500
501 • I is the initial commit, in which foo exists with contents “asdf”,
502 and a file quux exists with contents “quux”. Initial commits are
503 compared to an empty tree, so I is !TREESAME.
504
505 • In A, foo contains just “foo”.
506
507 • B contains the same change as A. Its merge M is trivial and hence
508 TREESAME to all parents.
509
510 • C does not change foo, but its merge N changes it to “foobar”, so
511 it is not TREESAME to any parent.
512
513 • D sets foo to “baz”. Its merge O combines the strings from N and D
514 to “foobarbaz”; i.e., it is not TREESAME to any parent.
515
516 • E changes quux to “xyzzy”, and its merge P combines the strings to
517 “quux xyzzy”. P is TREESAME to O, but not to E.
518
519 • X is an independent root commit that added a new file side, and Y
520 modified it. Y is TREESAME to X. Its merge Q added side to P, and
521 Q is TREESAME to P, but not to Y.
522
523 rev-list walks backwards through history, including or excluding
524 commits based on whether --full-history and/or parent rewriting (via
525 --parents or --children) are used. The following settings are
526 available.
527
528 Default mode
529 Commits are included if they are not TREESAME to any parent (though
530 this can be changed, see --sparse below). If the commit was a
531 merge, and it was TREESAME to one parent, follow only that parent.
532 (Even if there are several TREESAME parents, follow only one of
533 them.) Otherwise, follow all parents.
534
535 This results in:
536
537 .-A---N---O
538 / / /
539 I---------D
540
541 Note how the rule to only follow the TREESAME parent, if one is
542 available, removed B from consideration entirely. C was considered
543 via N, but is TREESAME. Root commits are compared to an empty tree,
544 so I is !TREESAME.
545
546 Parent/child relations are only visible with --parents, but that
547 does not affect the commits selected in default mode, so we have
548 shown the parent lines.
549
550 --full-history without parent rewriting
551 This mode differs from the default in one point: always follow all
552 parents of a merge, even if it is TREESAME to one of them. Even if
553 more than one side of the merge has commits that are included, this
554 does not imply that the merge itself is! In the example, we get
555
556 I A B N D O P Q
557
558 M was excluded because it is TREESAME to both parents. E, C and B
559 were all walked, but only B was !TREESAME, so the others do not
560 appear.
561
562 Note that without parent rewriting, it is not really possible to
563 talk about the parent/child relationships between the commits, so
564 we show them disconnected.
565
566 --full-history with parent rewriting
567 Ordinary commits are only included if they are !TREESAME (though
568 this can be changed, see --sparse below).
569
570 Merges are always included. However, their parent list is
571 rewritten: Along each parent, prune away commits that are not
572 included themselves. This results in
573
574 .-A---M---N---O---P---Q
575 / / / / /
576 I B / D /
577 \ / / / /
578 `-------------'
579
580 Compare to --full-history without rewriting above. Note that E was
581 pruned away because it is TREESAME, but the parent list of P was
582 rewritten to contain E's parent I. The same happened for C and N,
583 and X, Y and Q.
584
585 In addition to the above settings, you can change whether TREESAME
586 affects inclusion:
587
588 --dense
589 Commits that are walked are included if they are not TREESAME to
590 any parent.
591
592 --sparse
593 All commits that are walked are included.
594
595 Note that without --full-history, this still simplifies merges: if
596 one of the parents is TREESAME, we follow only that one, so the
597 other sides of the merge are never walked.
598
599 --simplify-merges
600 First, build a history graph in the same way that --full-history
601 with parent rewriting does (see above).
602
603 Then simplify each commit C to its replacement C' in the final
604 history according to the following rules:
605
606 • Set C' to C.
607
608 • Replace each parent P of C' with its simplification P'. In the
609 process, drop parents that are ancestors of other parents or
610 that are root commits TREESAME to an empty tree, and remove
611 duplicates, but take care to never drop all parents that we are
612 TREESAME to.
613
614 • If after this parent rewriting, C' is a root or merge commit
615 (has zero or >1 parents), a boundary commit, or !TREESAME, it
616 remains. Otherwise, it is replaced with its only parent.
617
618 The effect of this is best shown by way of comparing to
619 --full-history with parent rewriting. The example turns into:
620
621 .-A---M---N---O
622 / / /
623 I B D
624 \ / /
625 `---------'
626
627 Note the major differences in N, P, and Q over --full-history:
628
629 • N's parent list had I removed, because it is an ancestor of the
630 other parent M. Still, N remained because it is !TREESAME.
631
632 • P's parent list similarly had I removed. P was then removed
633 completely, because it had one parent and is TREESAME.
634
635 • Q's parent list had Y simplified to X. X was then removed,
636 because it was a TREESAME root. Q was then removed completely,
637 because it had one parent and is TREESAME.
638
639 There is another simplification mode available:
640
641 --ancestry-path
642 Limit the displayed commits to those directly on the ancestry chain
643 between the “from” and “to” commits in the given commit range. I.e.
644 only display commits that are ancestor of the “to” commit and
645 descendants of the “from” commit.
646
647 As an example use case, consider the following commit history:
648
649 D---E-------F
650 / \ \
651 B---C---G---H---I---J
652 / \
653 A-------K---------------L--M
654
655 A regular D..M computes the set of commits that are ancestors of M,
656 but excludes the ones that are ancestors of D. This is useful to
657 see what happened to the history leading to M since D, in the sense
658 that “what does M have that did not exist in D”. The result in this
659 example would be all the commits, except A and B (and D itself, of
660 course).
661
662 When we want to find out what commits in M are contaminated with
663 the bug introduced by D and need fixing, however, we might want to
664 view only the subset of D..M that are actually descendants of D,
665 i.e. excluding C and K. This is exactly what the --ancestry-path
666 option does. Applied to the D..M range, it results in:
667
668 E-------F
669 \ \
670 G---H---I---J
671 \
672 L--M
673
674 Before discussing another option, --show-pulls, we need to create a new
675 example history.
676
677 A common problem users face when looking at simplified history is that
678 a commit they know changed a file somehow does not appear in the file’s
679 simplified history. Let’s demonstrate a new example and show how
680 options such as --full-history and --simplify-merges works in that
681 case:
682
683 .-A---M-----C--N---O---P
684 / / \ \ \/ / /
685 I B \ R-'`-Z' /
686 \ / \/ /
687 \ / /\ /
688 `---X--' `---Y--'
689
690 For this example, suppose I created file.txt which was modified by A,
691 B, and X in different ways. The single-parent commits C, Z, and Y do
692 not change file.txt. The merge commit M was created by resolving the
693 merge conflict to include both changes from A and B and hence is not
694 TREESAME to either. The merge commit R, however, was created by
695 ignoring the contents of file.txt at M and taking only the contents of
696 file.txt at X. Hence, R is TREESAME to X but not M. Finally, the
697 natural merge resolution to create N is to take the contents of
698 file.txt at R, so N is TREESAME to R but not C. The merge commits O and
699 P are TREESAME to their first parents, but not to their second parents,
700 Z and Y respectively.
701
702 When using the default mode, N and R both have a TREESAME parent, so
703 those edges are walked and the others are ignored. The resulting
704 history graph is:
705
706 I---X
707
708 When using --full-history, Git walks every edge. This will discover the
709 commits A and B and the merge M, but also will reveal the merge commits
710 O and P. With parent rewriting, the resulting graph is:
711
712 .-A---M--------N---O---P
713 / / \ \ \/ / /
714 I B \ R-'`--' /
715 \ / \/ /
716 \ / /\ /
717 `---X--' `------'
718
719 Here, the merge commits O and P contribute extra noise, as they did not
720 actually contribute a change to file.txt. They only merged a topic that
721 was based on an older version of file.txt. This is a common issue in
722 repositories using a workflow where many contributors work in parallel
723 and merge their topic branches along a single trunk: manu unrelated
724 merges appear in the --full-history results.
725
726 When using the --simplify-merges option, the commits O and P disappear
727 from the results. This is because the rewritten second parents of O and
728 P are reachable from their first parents. Those edges are removed and
729 then the commits look like single-parent commits that are TREESAME to
730 their parent. This also happens to the commit N, resulting in a history
731 view as follows:
732
733 .-A---M--.
734 / / \
735 I B R
736 \ / /
737 \ / /
738 `---X--'
739
740 In this view, we see all of the important single-parent changes from A,
741 B, and X. We also see the carefully-resolved merge M and the
742 not-so-carefully-resolved merge R. This is usually enough information
743 to determine why the commits A and B "disappeared" from history in the
744 default view. However, there are a few issues with this approach.
745
746 The first issue is performance. Unlike any previous option, the
747 --simplify-merges option requires walking the entire commit history
748 before returning a single result. This can make the option difficult to
749 use for very large repositories.
750
751 The second issue is one of auditing. When many contributors are working
752 on the same repository, it is important which merge commits introduced
753 a change into an important branch. The problematic merge R above is not
754 likely to be the merge commit that was used to merge into an important
755 branch. Instead, the merge N was used to merge R and X into the
756 important branch. This commit may have information about why the change
757 X came to override the changes from A and B in its commit message.
758
759 --show-pulls
760 In addition to the commits shown in the default history, show each
761 merge commit that is not TREESAME to its first parent but is
762 TREESAME to a later parent.
763
764 When a merge commit is included by --show-pulls, the merge is
765 treated as if it "pulled" the change from another branch. When
766 using --show-pulls on this example (and no other options) the
767 resulting graph is:
768
769 I---X---R---N
770
771 Here, the merge commits R and N are included because they pulled
772 the commits X and R into the base branch, respectively. These
773 merges are the reason the commits A and B do not appear in the
774 default history.
775
776 When --show-pulls is paired with --simplify-merges, the graph
777 includes all of the necessary information:
778
779 .-A---M--. N
780 / / \ /
781 I B R
782 \ / /
783 \ / /
784 `---X--'
785
786 Notice that since M is reachable from R, the edge from N to M was
787 simplified away. However, N still appears in the history as an
788 important commit because it "pulled" the change R into the main
789 branch.
790
791 The --simplify-by-decoration option allows you to view only the big
792 picture of the topology of the history, by omitting commits that are
793 not referenced by tags. Commits are marked as !TREESAME (in other
794 words, kept after history simplification rules described above) if (1)
795 they are referenced by tags, or (2) they change the contents of the
796 paths given on the command line. All other commits are marked as
797 TREESAME (subject to be simplified away).
798
799 Commit Ordering
800 By default, the commits are shown in reverse chronological order.
801
802 --date-order
803 Show no parents before all of its children are shown, but otherwise
804 show commits in the commit timestamp order.
805
806 --author-date-order
807 Show no parents before all of its children are shown, but otherwise
808 show commits in the author timestamp order.
809
810 --topo-order
811 Show no parents before all of its children are shown, and avoid
812 showing commits on multiple lines of history intermixed.
813
814 For example, in a commit history like this:
815
816 ---1----2----4----7
817 \ \
818 3----5----6----8---
819
820 where the numbers denote the order of commit timestamps, git
821 rev-list and friends with --date-order show the commits in the
822 timestamp order: 8 7 6 5 4 3 2 1.
823
824 With --topo-order, they would show 8 6 5 3 7 4 2 1 (or 8 7 4 2 6 5
825 3 1); some older commits are shown before newer ones in order to
826 avoid showing the commits from two parallel development track mixed
827 together.
828
829 --reverse
830 Output the commits chosen to be shown (see Commit Limiting section
831 above) in reverse order. Cannot be combined with --walk-reflogs.
832
833 Object Traversal
834 These options are mostly targeted for packing of Git repositories.
835
836 --no-walk[=(sorted|unsorted)]
837 Only show the given commits, but do not traverse their ancestors.
838 This has no effect if a range is specified. If the argument
839 unsorted is given, the commits are shown in the order they were
840 given on the command line. Otherwise (if sorted or no argument was
841 given), the commits are shown in reverse chronological order by
842 commit time. Cannot be combined with --graph.
843
844 --do-walk
845 Overrides a previous --no-walk.
846
847 Commit Formatting
848 --pretty[=<format>], --format=<format>
849 Pretty-print the contents of the commit logs in a given format,
850 where <format> can be one of oneline, short, medium, full, fuller,
851 reference, email, raw, format:<string> and tformat:<string>. When
852 <format> is none of the above, and has %placeholder in it, it acts
853 as if --pretty=tformat:<format> were given.
854
855 See the "PRETTY FORMATS" section for some additional details for
856 each format. When =<format> part is omitted, it defaults to medium.
857
858 Note: you can specify the default pretty format in the repository
859 configuration (see git-config(1)).
860
861 --abbrev-commit
862 Instead of showing the full 40-byte hexadecimal commit object name,
863 show a prefix that names the object uniquely. "--abbrev=<n>" (which
864 also modifies diff output, if it is displayed) option can be used
865 to specify the minimum length of the prefix.
866
867 This should make "--pretty=oneline" a whole lot more readable for
868 people using 80-column terminals.
869
870 --no-abbrev-commit
871 Show the full 40-byte hexadecimal commit object name. This negates
872 --abbrev-commit, either explicit or implied by other options such
873 as "--oneline". It also overrides the log.abbrevCommit variable.
874
875 --oneline
876 This is a shorthand for "--pretty=oneline --abbrev-commit" used
877 together.
878
879 --encoding=<encoding>
880 Commit objects record the character encoding used for the log
881 message in their encoding header; this option can be used to tell
882 the command to re-code the commit log message in the encoding
883 preferred by the user. For non plumbing commands this defaults to
884 UTF-8. Note that if an object claims to be encoded in X and we are
885 outputting in X, we will output the object verbatim; this means
886 that invalid sequences in the original commit may be copied to the
887 output. Likewise, if iconv(3) fails to convert the commit, we will
888 quietly output the original object verbatim.
889
890 --expand-tabs=<n>, --expand-tabs, --no-expand-tabs
891 Perform a tab expansion (replace each tab with enough spaces to
892 fill to the next display column that is multiple of <n>) in the log
893 message before showing it in the output. --expand-tabs is a
894 short-hand for --expand-tabs=8, and --no-expand-tabs is a
895 short-hand for --expand-tabs=0, which disables tab expansion.
896
897 By default, tabs are expanded in pretty formats that indent the log
898 message by 4 spaces (i.e. medium, which is the default, full, and
899 fuller).
900
901 --notes[=<ref>]
902 Show the notes (see git-notes(1)) that annotate the commit, when
903 showing the commit log message. This is the default for git log,
904 git show and git whatchanged commands when there is no --pretty,
905 --format, or --oneline option given on the command line.
906
907 By default, the notes shown are from the notes refs listed in the
908 core.notesRef and notes.displayRef variables (or corresponding
909 environment overrides). See git-config(1) for more details.
910
911 With an optional <ref> argument, use the ref to find the notes to
912 display. The ref can specify the full refname when it begins with
913 refs/notes/; when it begins with notes/, refs/ and otherwise
914 refs/notes/ is prefixed to form a full name of the ref.
915
916 Multiple --notes options can be combined to control which notes are
917 being displayed. Examples: "--notes=foo" will show only notes from
918 "refs/notes/foo"; "--notes=foo --notes" will show both notes from
919 "refs/notes/foo" and from the default notes ref(s).
920
921 --no-notes
922 Do not show notes. This negates the above --notes option, by
923 resetting the list of notes refs from which notes are shown.
924 Options are parsed in the order given on the command line, so e.g.
925 "--notes --notes=foo --no-notes --notes=bar" will only show notes
926 from "refs/notes/bar".
927
928 --show-notes[=<ref>], --[no-]standard-notes
929 These options are deprecated. Use the above --notes/--no-notes
930 options instead.
931
932 --show-signature
933 Check the validity of a signed commit object by passing the
934 signature to gpg --verify and show the output.
935
936 --relative-date
937 Synonym for --date=relative.
938
939 --date=<format>
940 Only takes effect for dates shown in human-readable format, such as
941 when using --pretty. log.date config variable sets a default value
942 for the log command’s --date option. By default, dates are shown in
943 the original time zone (either committer’s or author’s). If -local
944 is appended to the format (e.g., iso-local), the user’s local time
945 zone is used instead.
946
947 --date=relative shows dates relative to the current time, e.g. “2
948 hours ago”. The -local option has no effect for --date=relative.
949
950 --date=local is an alias for --date=default-local.
951
952 --date=iso (or --date=iso8601) shows timestamps in a ISO 8601-like
953 format. The differences to the strict ISO 8601 format are:
954
955 • a space instead of the T date/time delimiter
956
957 • a space between time and time zone
958
959 • no colon between hours and minutes of the time zone
960
961 --date=iso-strict (or --date=iso8601-strict) shows timestamps in
962 strict ISO 8601 format.
963
964 --date=rfc (or --date=rfc2822) shows timestamps in RFC 2822 format,
965 often found in email messages.
966
967 --date=short shows only the date, but not the time, in YYYY-MM-DD
968 format.
969
970 --date=raw shows the date as seconds since the epoch (1970-01-01
971 00:00:00 UTC), followed by a space, and then the timezone as an
972 offset from UTC (a + or - with four digits; the first two are
973 hours, and the second two are minutes). I.e., as if the timestamp
974 were formatted with strftime("%s %z")). Note that the -local option
975 does not affect the seconds-since-epoch value (which is always
976 measured in UTC), but does switch the accompanying timezone value.
977
978 --date=human shows the timezone if the timezone does not match the
979 current time-zone, and doesn’t print the whole date if that matches
980 (ie skip printing year for dates that are "this year", but also
981 skip the whole date itself if it’s in the last few days and we can
982 just say what weekday it was). For older dates the hour and minute
983 is also omitted.
984
985 --date=unix shows the date as a Unix epoch timestamp (seconds since
986 1970). As with --raw, this is always in UTC and therefore -local
987 has no effect.
988
989 --date=format:... feeds the format ... to your system strftime,
990 except for %s, %z, and %Z, which are handled internally. Use
991 --date=format:%c to show the date in your system locale’s preferred
992 format. See the strftime manual for a complete list of format
993 placeholders. When using -local, the correct syntax is
994 --date=format-local:....
995
996 --date=default is the default format, and is similar to
997 --date=rfc2822, with a few exceptions:
998
999 • there is no comma after the day-of-week
1000
1001 • the time zone is omitted when the local time zone is used
1002
1003 --parents
1004 Print also the parents of the commit (in the form "commit parent...
1005 "). Also enables parent rewriting, see History Simplification
1006 above.
1007
1008 --children
1009 Print also the children of the commit (in the form "commit child...
1010 "). Also enables parent rewriting, see History Simplification
1011 above.
1012
1013 --left-right
1014 Mark which side of a symmetric difference a commit is reachable
1015 from. Commits from the left side are prefixed with < and those from
1016 the right with >. If combined with --boundary, those commits are
1017 prefixed with -.
1018
1019 For example, if you have this topology:
1020
1021 y---b---b branch B
1022 / \ /
1023 / .
1024 / / \
1025 o---x---a---a branch A
1026
1027 you would get an output like this:
1028
1029 $ git rev-list --left-right --boundary --pretty=oneline A...B
1030
1031 >bbbbbbb... 3rd on b
1032 >bbbbbbb... 2nd on b
1033 <aaaaaaa... 3rd on a
1034 <aaaaaaa... 2nd on a
1035 -yyyyyyy... 1st on b
1036 -xxxxxxx... 1st on a
1037
1038 --graph
1039 Draw a text-based graphical representation of the commit history on
1040 the left hand side of the output. This may cause extra lines to be
1041 printed in between commits, in order for the graph history to be
1042 drawn properly. Cannot be combined with --no-walk.
1043
1044 This enables parent rewriting, see History Simplification above.
1045
1046 This implies the --topo-order option by default, but the
1047 --date-order option may also be specified.
1048
1049 --show-linear-break[=<barrier>]
1050 When --graph is not used, all history branches are flattened which
1051 can make it hard to see that the two consecutive commits do not
1052 belong to a linear branch. This option puts a barrier in between
1053 them in that case. If <barrier> is specified, it is the string that
1054 will be shown instead of the default one.
1055
1057 If the commit is a merge, and if the pretty-format is not oneline,
1058 email or raw, an additional line is inserted before the Author: line.
1059 This line begins with "Merge: " and the hashes of ancestral commits are
1060 printed, separated by spaces. Note that the listed commits may not
1061 necessarily be the list of the direct parent commits if you have
1062 limited your view of history: for example, if you are only interested
1063 in changes related to a certain directory or file.
1064
1065 There are several built-in formats, and you can define additional
1066 formats by setting a pretty.<name> config option to either another
1067 format name, or a format: string, as described below (see git-
1068 config(1)). Here are the details of the built-in formats:
1069
1070 • oneline
1071
1072 <hash> <title-line>
1073
1074 This is designed to be as compact as possible.
1075
1076 • short
1077
1078 commit <hash>
1079 Author: <author>
1080
1081 <title-line>
1082
1083 • medium
1084
1085 commit <hash>
1086 Author: <author>
1087 Date: <author-date>
1088
1089 <title-line>
1090
1091 <full-commit-message>
1092
1093 • full
1094
1095 commit <hash>
1096 Author: <author>
1097 Commit: <committer>
1098
1099 <title-line>
1100
1101 <full-commit-message>
1102
1103 • fuller
1104
1105 commit <hash>
1106 Author: <author>
1107 AuthorDate: <author-date>
1108 Commit: <committer>
1109 CommitDate: <committer-date>
1110
1111 <title-line>
1112
1113 <full-commit-message>
1114
1115 • reference
1116
1117 <abbrev-hash> (<title-line>, <short-author-date>)
1118
1119 This format is used to refer to another commit in a commit message
1120 and is the same as --pretty='format:%C(auto)%h (%s, %ad)'. By
1121 default, the date is formatted with --date=short unless another
1122 --date option is explicitly specified. As with any format: with
1123 format placeholders, its output is not affected by other options
1124 like --decorate and --walk-reflogs.
1125
1126 • email
1127
1128 From <hash> <date>
1129 From: <author>
1130 Date: <author-date>
1131 Subject: [PATCH] <title-line>
1132
1133 <full-commit-message>
1134
1135 • mboxrd
1136
1137 Like email, but lines in the commit message starting with "From "
1138 (preceded by zero or more ">") are quoted with ">" so they aren’t
1139 confused as starting a new commit.
1140
1141 • raw
1142
1143 The raw format shows the entire commit exactly as stored in the
1144 commit object. Notably, the hashes are displayed in full,
1145 regardless of whether --abbrev or --no-abbrev are used, and parents
1146 information show the true parent commits, without taking grafts or
1147 history simplification into account. Note that this format affects
1148 the way commits are displayed, but not the way the diff is shown
1149 e.g. with git log --raw. To get full object names in a raw diff
1150 format, use --no-abbrev.
1151
1152 • format:<format-string>
1153
1154 The format:<format-string> format allows you to specify which
1155 information you want to show. It works a little bit like printf
1156 format, with the notable exception that you get a newline with %n
1157 instead of \n.
1158
1159 E.g, format:"The author of %h was %an, %ar%nThe title was >>%s<<%n"
1160 would show something like this:
1161
1162 The author of fe6e0ee was Junio C Hamano, 23 hours ago
1163 The title was >>t4119: test autocomputing -p<n> for traditional diff input.<<
1164
1165 The placeholders are:
1166
1167 • Placeholders that expand to a single literal character:
1168
1169 %n
1170 newline
1171
1172 %%
1173 a raw %
1174
1175 %x00
1176 print a byte from a hex code
1177
1178 • Placeholders that affect formatting of later placeholders:
1179
1180 %Cred
1181 switch color to red
1182
1183 %Cgreen
1184 switch color to green
1185
1186 %Cblue
1187 switch color to blue
1188
1189 %Creset
1190 reset color
1191
1192 %C(...)
1193 color specification, as described under Values in the
1194 "CONFIGURATION FILE" section of git-config(1). By default,
1195 colors are shown only when enabled for log output (by
1196 color.diff, color.ui, or --color, and respecting the auto
1197 settings of the former if we are going to a terminal).
1198 %C(auto,...) is accepted as a historical synonym for the
1199 default (e.g., %C(auto,red)). Specifying %C(always,...)
1200 will show the colors even when color is not otherwise
1201 enabled (though consider just using --color=always to
1202 enable color for the whole output, including this format
1203 and anything else git might color). auto alone (i.e.
1204 %C(auto)) will turn on auto coloring on the next
1205 placeholders until the color is switched again.
1206
1207 %m
1208 left (<), right (>) or boundary (-) mark
1209
1210 %w([<w>[,<i1>[,<i2>]]])
1211 switch line wrapping, like the -w option of git-
1212 shortlog(1).
1213
1214 %<(<N>[,trunc|ltrunc|mtrunc])
1215 make the next placeholder take at least N columns, padding
1216 spaces on the right if necessary. Optionally truncate at
1217 the beginning (ltrunc), the middle (mtrunc) or the end
1218 (trunc) if the output is longer than N columns. Note that
1219 truncating only works correctly with N >= 2.
1220
1221 %<|(<N>)
1222 make the next placeholder take at least until Nth columns,
1223 padding spaces on the right if necessary
1224
1225 %>(<N>), %>|(<N>)
1226 similar to %<(<N>), %<|(<N>) respectively, but padding
1227 spaces on the left
1228
1229 %>>(<N>), %>>|(<N>)
1230 similar to %>(<N>), %>|(<N>) respectively, except that if
1231 the next placeholder takes more spaces than given and there
1232 are spaces on its left, use those spaces
1233
1234 %><(<N>), %><|(<N>)
1235 similar to %<(<N>), %<|(<N>) respectively, but padding both
1236 sides (i.e. the text is centered)
1237
1238 • Placeholders that expand to information extracted from the
1239 commit:
1240
1241 %H
1242 commit hash
1243
1244 %h
1245 abbreviated commit hash
1246
1247 %T
1248 tree hash
1249
1250 %t
1251 abbreviated tree hash
1252
1253 %P
1254 parent hashes
1255
1256 %p
1257 abbreviated parent hashes
1258
1259 %an
1260 author name
1261
1262 %aN
1263 author name (respecting .mailmap, see git-shortlog(1) or
1264 git-blame(1))
1265
1266 %ae
1267 author email
1268
1269 %aE
1270 author email (respecting .mailmap, see git-shortlog(1) or
1271 git-blame(1))
1272
1273 %al
1274 author email local-part (the part before the @ sign)
1275
1276 %aL
1277 author local-part (see %al) respecting .mailmap, see git-
1278 shortlog(1) or git-blame(1))
1279
1280 %ad
1281 author date (format respects --date= option)
1282
1283 %aD
1284 author date, RFC2822 style
1285
1286 %ar
1287 author date, relative
1288
1289 %at
1290 author date, UNIX timestamp
1291
1292 %ai
1293 author date, ISO 8601-like format
1294
1295 %aI
1296 author date, strict ISO 8601 format
1297
1298 %as
1299 author date, short format (YYYY-MM-DD)
1300
1301 %ah
1302 author date, human style (like the --date=human option of
1303 git-rev-list(1))
1304
1305 %cn
1306 committer name
1307
1308 %cN
1309 committer name (respecting .mailmap, see git-shortlog(1) or
1310 git-blame(1))
1311
1312 %ce
1313 committer email
1314
1315 %cE
1316 committer email (respecting .mailmap, see git-shortlog(1)
1317 or git-blame(1))
1318
1319 %cl
1320 committer email local-part (the part before the @ sign)
1321
1322 %cL
1323 committer local-part (see %cl) respecting .mailmap, see
1324 git-shortlog(1) or git-blame(1))
1325
1326 %cd
1327 committer date (format respects --date= option)
1328
1329 %cD
1330 committer date, RFC2822 style
1331
1332 %cr
1333 committer date, relative
1334
1335 %ct
1336 committer date, UNIX timestamp
1337
1338 %ci
1339 committer date, ISO 8601-like format
1340
1341 %cI
1342 committer date, strict ISO 8601 format
1343
1344 %cs
1345 committer date, short format (YYYY-MM-DD)
1346
1347 %ch
1348 committer date, human style (like the --date=human option
1349 of git-rev-list(1))
1350
1351 %d
1352 ref names, like the --decorate option of git-log(1)
1353
1354 %D
1355 ref names without the " (", ")" wrapping.
1356
1357 %(describe[:options])
1358 human-readable name, like git-describe(1); empty string for
1359 undescribable commits. The describe string may be followed
1360 by a colon and zero or more comma-separated options.
1361 Descriptions can be inconsistent when tags are added or
1362 removed at the same time.
1363
1364 • tags[=<bool-value>]: Instead of only considering
1365 annotated tags, consider lightweight tags as well.
1366
1367 • abbrev=<number>: Instead of using the default number of
1368 hexadecimal digits (which will vary according to the
1369 number of objects in the repository with a default of
1370 7) of the abbreviated object name, use <number> digits,
1371 or as many digits as needed to form a unique object
1372 name.
1373
1374 • match=<pattern>: Only consider tags matching the given
1375 glob(7) pattern, excluding the "refs/tags/" prefix.
1376
1377 • exclude=<pattern>: Do not consider tags matching the
1378 given glob(7) pattern, excluding the "refs/tags/"
1379 prefix.
1380
1381 %S
1382 ref name given on the command line by which the commit was
1383 reached (like git log --source), only works with git log
1384
1385 %e
1386 encoding
1387
1388 %s
1389 subject
1390
1391 %f
1392 sanitized subject line, suitable for a filename
1393
1394 %b
1395 body
1396
1397 %B
1398 raw body (unwrapped subject and body)
1399
1400 %N
1401 commit notes
1402
1403 %GG
1404 raw verification message from GPG for a signed commit
1405
1406 %G?
1407 show "G" for a good (valid) signature, "B" for a bad
1408 signature, "U" for a good signature with unknown validity,
1409 "X" for a good signature that has expired, "Y" for a good
1410 signature made by an expired key, "R" for a good signature
1411 made by a revoked key, "E" if the signature cannot be
1412 checked (e.g. missing key) and "N" for no signature
1413
1414 %GS
1415 show the name of the signer for a signed commit
1416
1417 %GK
1418 show the key used to sign a signed commit
1419
1420 %GF
1421 show the fingerprint of the key used to sign a signed
1422 commit
1423
1424 %GP
1425 show the fingerprint of the primary key whose subkey was
1426 used to sign a signed commit
1427
1428 %GT
1429 show the trust level for the key used to sign a signed
1430 commit
1431
1432 %gD
1433 reflog selector, e.g., refs/stash@{1} or refs/stash@{2
1434 minutes ago}; the format follows the rules described for
1435 the -g option. The portion before the @ is the refname as
1436 given on the command line (so git log -g refs/heads/master
1437 would yield refs/heads/master@{0}).
1438
1439 %gd
1440 shortened reflog selector; same as %gD, but the refname
1441 portion is shortened for human readability (so
1442 refs/heads/master becomes just master).
1443
1444 %gn
1445 reflog identity name
1446
1447 %gN
1448 reflog identity name (respecting .mailmap, see git-
1449 shortlog(1) or git-blame(1))
1450
1451 %ge
1452 reflog identity email
1453
1454 %gE
1455 reflog identity email (respecting .mailmap, see git-
1456 shortlog(1) or git-blame(1))
1457
1458 %gs
1459 reflog subject
1460
1461 %(trailers[:options])
1462 display the trailers of the body as interpreted by git-
1463 interpret-trailers(1). The trailers string may be followed
1464 by a colon and zero or more comma-separated options. If any
1465 option is provided multiple times the last occurrence wins.
1466
1467 • key=<key>: only show trailers with specified <key>.
1468 Matching is done case-insensitively and trailing colon
1469 is optional. If option is given multiple times trailer
1470 lines matching any of the keys are shown. This option
1471 automatically enables the only option so that
1472 non-trailer lines in the trailer block are hidden. If
1473 that is not desired it can be disabled with only=false.
1474 E.g., %(trailers:key=Reviewed-by) shows trailer lines
1475 with key Reviewed-by.
1476
1477 • only[=<bool>]: select whether non-trailer lines from
1478 the trailer block should be included.
1479
1480 • separator=<sep>: specify a separator inserted between
1481 trailer lines. When this option is not given each
1482 trailer line is terminated with a line feed character.
1483 The string <sep> may contain the literal formatting
1484 codes described above. To use comma as separator one
1485 must use %x2C as it would otherwise be parsed as next
1486 option. E.g., %(trailers:key=Ticket,separator=%x2C )
1487 shows all trailer lines whose key is "Ticket" separated
1488 by a comma and a space.
1489
1490 • unfold[=<bool>]: make it behave as if
1491 interpret-trailer’s --unfold option was given. E.g.,
1492 %(trailers:only,unfold=true) unfolds and shows all
1493 trailer lines.
1494
1495 • keyonly[=<bool>]: only show the key part of the
1496 trailer.
1497
1498 • valueonly[=<bool>]: only show the value part of the
1499 trailer.
1500
1501 • key_value_separator=<sep>: specify a separator inserted
1502 between trailer lines. When this option is not given
1503 each trailer key-value pair is separated by ": ".
1504 Otherwise it shares the same semantics as
1505 separator=<sep> above.
1506
1507 Note
1508 Some placeholders may depend on other options given to the revision
1509 traversal engine. For example, the %g* reflog options will insert
1510 an empty string unless we are traversing reflog entries (e.g., by
1511 git log -g). The %d and %D placeholders will use the "short"
1512 decoration format if --decorate was not already provided on the
1513 command line.
1514
1515 The boolean options accept an optional value [=<bool-value>]. The
1516 values true, false, on, off etc. are all accepted. See the "boolean"
1517 sub-section in "EXAMPLES" in git-config(1). If a boolean option is
1518 given with no value, it’s enabled.
1519
1520 If you add a + (plus sign) after % of a placeholder, a line-feed is
1521 inserted immediately before the expansion if and only if the
1522 placeholder expands to a non-empty string.
1523
1524 If you add a - (minus sign) after % of a placeholder, all consecutive
1525 line-feeds immediately preceding the expansion are deleted if and only
1526 if the placeholder expands to an empty string.
1527
1528 If you add a ` ` (space) after % of a placeholder, a space is inserted
1529 immediately before the expansion if and only if the placeholder expands
1530 to a non-empty string.
1531
1532 • tformat:
1533
1534 The tformat: format works exactly like format:, except that it
1535 provides "terminator" semantics instead of "separator" semantics.
1536 In other words, each commit has the message terminator character
1537 (usually a newline) appended, rather than a separator placed
1538 between entries. This means that the final entry of a single-line
1539 format will be properly terminated with a new line, just as the
1540 "oneline" format does. For example:
1541
1542 $ git log -2 --pretty=format:%h 4da45bef \
1543 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
1544 4da45be
1545 7134973 -- NO NEWLINE
1546
1547 $ git log -2 --pretty=tformat:%h 4da45bef \
1548 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
1549 4da45be
1550 7134973
1551
1552 In addition, any unrecognized string that has a % in it is
1553 interpreted as if it has tformat: in front of it. For example,
1554 these two are equivalent:
1555
1556 $ git log -2 --pretty=tformat:%h 4da45bef
1557 $ git log -2 --pretty=%h 4da45bef
1558
1560 By default, git log does not generate any diff output. The options
1561 below can be used to show the changes made by each commit.
1562
1563 Note that unless one of --diff-merges variants (including short -m, -c,
1564 and --cc options) is explicitly given, merge commits will not show a
1565 diff, even if a diff format like --patch is selected, nor will they
1566 match search options like -S. The exception is when --first-parent is
1567 in use, in which case first-parent is the default format.
1568
1569 -p, -u, --patch
1570 Generate patch (see section on generating patches).
1571
1572 -s, --no-patch
1573 Suppress diff output. Useful for commands like git show that show
1574 the patch by default, or to cancel the effect of --patch.
1575
1576 --diff-merges=(off|none|on|first-parent|1|separate|m|combined|c|dense-combined|cc|remerge|r),
1577 --no-diff-merges
1578 Specify diff format to be used for merge commits. Default is `off`
1579 unless --first-parent is in use, in which case first-parent is the
1580 default.
1581
1582 --diff-merges=(off|none), --no-diff-merges
1583 Disable output of diffs for merge commits. Useful to override
1584 implied value.
1585
1586 --diff-merges=on, --diff-merges=m, -m
1587 This option makes diff output for merge commits to be shown in
1588 the default format. -m will produce the output only if -p is
1589 given as well. The default format could be changed using
1590 log.diffMerges configuration parameter, which default value is
1591 separate.
1592
1593 --diff-merges=first-parent, --diff-merges=1
1594 This option makes merge commits show the full diff with respect
1595 to the first parent only.
1596
1597 --diff-merges=separate
1598 This makes merge commits show the full diff with respect to
1599 each of the parents. Separate log entry and diff is generated
1600 for each parent.
1601
1602 --diff-merges=remerge, --diff-merges=r, --remerge-diff
1603 With this option, two-parent merge commits are remerged to
1604 create a temporary tree object — potentially containing files
1605 with conflict markers and such. A diff is then shown between
1606 that temporary tree and the actual merge commit.
1607
1608 The output emitted when this option is used is subject to
1609 change, and so is its interaction with other options (unless
1610 explicitly documented).
1611
1612 --diff-merges=combined, --diff-merges=c, -c
1613 With this option, diff output for a merge commit shows the
1614 differences from each of the parents to the merge result
1615 simultaneously instead of showing pairwise diff between a
1616 parent and the result one at a time. Furthermore, it lists only
1617 files which were modified from all parents. -c implies -p.
1618
1619 --diff-merges=dense-combined, --diff-merges=cc, --cc
1620 With this option the output produced by --diff-merges=combined
1621 is further compressed by omitting uninteresting hunks whose
1622 contents in the parents have only two variants and the merge
1623 result picks one of them without modification. --cc implies
1624 -p.
1625
1626 --combined-all-paths
1627 This flag causes combined diffs (used for merge commits) to list
1628 the name of the file from all parents. It thus only has effect when
1629 --diff-merges=[dense-]combined is in use, and is likely only useful
1630 if filename changes are detected (i.e. when either rename or copy
1631 detection have been requested).
1632
1633 -U<n>, --unified=<n>
1634 Generate diffs with <n> lines of context instead of the usual
1635 three. Implies --patch.
1636
1637 --output=<file>
1638 Output to a specific file instead of stdout.
1639
1640 --output-indicator-new=<char>, --output-indicator-old=<char>,
1641 --output-indicator-context=<char>
1642 Specify the character used to indicate new, old or context lines in
1643 the generated patch. Normally they are +, - and ' ' respectively.
1644
1645 --raw
1646 For each commit, show a summary of changes using the raw diff
1647 format. See the "RAW OUTPUT FORMAT" section of git-diff(1). This is
1648 different from showing the log itself in raw format, which you can
1649 achieve with --format=raw.
1650
1651 --patch-with-raw
1652 Synonym for -p --raw.
1653
1654 -t
1655 Show the tree objects in the diff output.
1656
1657 --indent-heuristic
1658 Enable the heuristic that shifts diff hunk boundaries to make
1659 patches easier to read. This is the default.
1660
1661 --no-indent-heuristic
1662 Disable the indent heuristic.
1663
1664 --minimal
1665 Spend extra time to make sure the smallest possible diff is
1666 produced.
1667
1668 --patience
1669 Generate a diff using the "patience diff" algorithm.
1670
1671 --histogram
1672 Generate a diff using the "histogram diff" algorithm.
1673
1674 --anchored=<text>
1675 Generate a diff using the "anchored diff" algorithm.
1676
1677 This option may be specified more than once.
1678
1679 If a line exists in both the source and destination, exists only
1680 once, and starts with this text, this algorithm attempts to prevent
1681 it from appearing as a deletion or addition in the output. It uses
1682 the "patience diff" algorithm internally.
1683
1684 --diff-algorithm={patience|minimal|histogram|myers}
1685 Choose a diff algorithm. The variants are as follows:
1686
1687 default, myers
1688 The basic greedy diff algorithm. Currently, this is the
1689 default.
1690
1691 minimal
1692 Spend extra time to make sure the smallest possible diff is
1693 produced.
1694
1695 patience
1696 Use "patience diff" algorithm when generating patches.
1697
1698 histogram
1699 This algorithm extends the patience algorithm to "support
1700 low-occurrence common elements".
1701
1702 For instance, if you configured the diff.algorithm variable to a
1703 non-default value and want to use the default one, then you have to
1704 use --diff-algorithm=default option.
1705
1706 --stat[=<width>[,<name-width>[,<count>]]]
1707 Generate a diffstat. By default, as much space as necessary will be
1708 used for the filename part, and the rest for the graph part.
1709 Maximum width defaults to terminal width, or 80 columns if not
1710 connected to a terminal, and can be overridden by <width>. The
1711 width of the filename part can be limited by giving another width
1712 <name-width> after a comma. The width of the graph part can be
1713 limited by using --stat-graph-width=<width> (affects all commands
1714 generating a stat graph) or by setting diff.statGraphWidth=<width>
1715 (does not affect git format-patch). By giving a third parameter
1716 <count>, you can limit the output to the first <count> lines,
1717 followed by ... if there are more.
1718
1719 These parameters can also be set individually with
1720 --stat-width=<width>, --stat-name-width=<name-width> and
1721 --stat-count=<count>.
1722
1723 --compact-summary
1724 Output a condensed summary of extended header information such as
1725 file creations or deletions ("new" or "gone", optionally "+l" if
1726 it’s a symlink) and mode changes ("+x" or "-x" for adding or
1727 removing executable bit respectively) in diffstat. The information
1728 is put between the filename part and the graph part. Implies
1729 --stat.
1730
1731 --numstat
1732 Similar to --stat, but shows number of added and deleted lines in
1733 decimal notation and pathname without abbreviation, to make it more
1734 machine friendly. For binary files, outputs two - instead of saying
1735 0 0.
1736
1737 --shortstat
1738 Output only the last line of the --stat format containing total
1739 number of modified files, as well as number of added and deleted
1740 lines.
1741
1742 -X[<param1,param2,...>], --dirstat[=<param1,param2,...>]
1743 Output the distribution of relative amount of changes for each
1744 sub-directory. The behavior of --dirstat can be customized by
1745 passing it a comma separated list of parameters. The defaults are
1746 controlled by the diff.dirstat configuration variable (see git-
1747 config(1)). The following parameters are available:
1748
1749 changes
1750 Compute the dirstat numbers by counting the lines that have
1751 been removed from the source, or added to the destination. This
1752 ignores the amount of pure code movements within a file. In
1753 other words, rearranging lines in a file is not counted as much
1754 as other changes. This is the default behavior when no
1755 parameter is given.
1756
1757 lines
1758 Compute the dirstat numbers by doing the regular line-based
1759 diff analysis, and summing the removed/added line counts. (For
1760 binary files, count 64-byte chunks instead, since binary files
1761 have no natural concept of lines). This is a more expensive
1762 --dirstat behavior than the changes behavior, but it does count
1763 rearranged lines within a file as much as other changes. The
1764 resulting output is consistent with what you get from the other
1765 --*stat options.
1766
1767 files
1768 Compute the dirstat numbers by counting the number of files
1769 changed. Each changed file counts equally in the dirstat
1770 analysis. This is the computationally cheapest --dirstat
1771 behavior, since it does not have to look at the file contents
1772 at all.
1773
1774 cumulative
1775 Count changes in a child directory for the parent directory as
1776 well. Note that when using cumulative, the sum of the
1777 percentages reported may exceed 100%. The default
1778 (non-cumulative) behavior can be specified with the
1779 noncumulative parameter.
1780
1781 <limit>
1782 An integer parameter specifies a cut-off percent (3% by
1783 default). Directories contributing less than this percentage of
1784 the changes are not shown in the output.
1785
1786 Example: The following will count changed files, while ignoring
1787 directories with less than 10% of the total amount of changed
1788 files, and accumulating child directory counts in the parent
1789 directories: --dirstat=files,10,cumulative.
1790
1791 --cumulative
1792 Synonym for --dirstat=cumulative
1793
1794 --dirstat-by-file[=<param1,param2>...]
1795 Synonym for --dirstat=files,param1,param2...
1796
1797 --summary
1798 Output a condensed summary of extended header information such as
1799 creations, renames and mode changes.
1800
1801 --patch-with-stat
1802 Synonym for -p --stat.
1803
1804 -z
1805 Separate the commits with NULs instead of with new newlines.
1806
1807 Also, when --raw or --numstat has been given, do not munge
1808 pathnames and use NULs as output field terminators.
1809
1810 Without this option, pathnames with "unusual" characters are quoted
1811 as explained for the configuration variable core.quotePath (see
1812 git-config(1)).
1813
1814 --name-only
1815 Show only names of changed files. The file names are often encoded
1816 in UTF-8. For more information see the discussion about encoding in
1817 the git-log(1) manual page.
1818
1819 --name-status
1820 Show only names and status of changed files. See the description of
1821 the --diff-filter option on what the status letters mean. Just like
1822 --name-only the file names are often encoded in UTF-8.
1823
1824 --submodule[=<format>]
1825 Specify how differences in submodules are shown. When specifying
1826 --submodule=short the short format is used. This format just shows
1827 the names of the commits at the beginning and end of the range.
1828 When --submodule or --submodule=log is specified, the log format is
1829 used. This format lists the commits in the range like git-
1830 submodule(1) summary does. When --submodule=diff is specified, the
1831 diff format is used. This format shows an inline diff of the
1832 changes in the submodule contents between the commit range.
1833 Defaults to diff.submodule or the short format if the config option
1834 is unset.
1835
1836 --color[=<when>]
1837 Show colored diff. --color (i.e. without =<when>) is the same as
1838 --color=always. <when> can be one of always, never, or auto.
1839
1840 --no-color
1841 Turn off colored diff. It is the same as --color=never.
1842
1843 --color-moved[=<mode>]
1844 Moved lines of code are colored differently. The <mode> defaults to
1845 no if the option is not given and to zebra if the option with no
1846 mode is given. The mode must be one of:
1847
1848 no
1849 Moved lines are not highlighted.
1850
1851 default
1852 Is a synonym for zebra. This may change to a more sensible mode
1853 in the future.
1854
1855 plain
1856 Any line that is added in one location and was removed in
1857 another location will be colored with color.diff.newMoved.
1858 Similarly color.diff.oldMoved will be used for removed lines
1859 that are added somewhere else in the diff. This mode picks up
1860 any moved line, but it is not very useful in a review to
1861 determine if a block of code was moved without permutation.
1862
1863 blocks
1864 Blocks of moved text of at least 20 alphanumeric characters are
1865 detected greedily. The detected blocks are painted using either
1866 the color.diff.{old,new}Moved color. Adjacent blocks cannot be
1867 told apart.
1868
1869 zebra
1870 Blocks of moved text are detected as in blocks mode. The blocks
1871 are painted using either the color.diff.{old,new}Moved color or
1872 color.diff.{old,new}MovedAlternative. The change between the
1873 two colors indicates that a new block was detected.
1874
1875 dimmed-zebra
1876 Similar to zebra, but additional dimming of uninteresting parts
1877 of moved code is performed. The bordering lines of two adjacent
1878 blocks are considered interesting, the rest is uninteresting.
1879 dimmed_zebra is a deprecated synonym.
1880
1881 --no-color-moved
1882 Turn off move detection. This can be used to override configuration
1883 settings. It is the same as --color-moved=no.
1884
1885 --color-moved-ws=<modes>
1886 This configures how whitespace is ignored when performing the move
1887 detection for --color-moved. These modes can be given as a comma
1888 separated list:
1889
1890 no
1891 Do not ignore whitespace when performing move detection.
1892
1893 ignore-space-at-eol
1894 Ignore changes in whitespace at EOL.
1895
1896 ignore-space-change
1897 Ignore changes in amount of whitespace. This ignores whitespace
1898 at line end, and considers all other sequences of one or more
1899 whitespace characters to be equivalent.
1900
1901 ignore-all-space
1902 Ignore whitespace when comparing lines. This ignores
1903 differences even if one line has whitespace where the other
1904 line has none.
1905
1906 allow-indentation-change
1907 Initially ignore any whitespace in the move detection, then
1908 group the moved code blocks only into a block if the change in
1909 whitespace is the same per line. This is incompatible with the
1910 other modes.
1911
1912 --no-color-moved-ws
1913 Do not ignore whitespace when performing move detection. This can
1914 be used to override configuration settings. It is the same as
1915 --color-moved-ws=no.
1916
1917 --word-diff[=<mode>]
1918 Show a word diff, using the <mode> to delimit changed words. By
1919 default, words are delimited by whitespace; see --word-diff-regex
1920 below. The <mode> defaults to plain, and must be one of:
1921
1922 color
1923 Highlight changed words using only colors. Implies --color.
1924
1925 plain
1926 Show words as [-removed-] and {+added+}. Makes no attempts to
1927 escape the delimiters if they appear in the input, so the
1928 output may be ambiguous.
1929
1930 porcelain
1931 Use a special line-based format intended for script
1932 consumption. Added/removed/unchanged runs are printed in the
1933 usual unified diff format, starting with a +/-/` ` character at
1934 the beginning of the line and extending to the end of the line.
1935 Newlines in the input are represented by a tilde ~ on a line of
1936 its own.
1937
1938 none
1939 Disable word diff again.
1940
1941 Note that despite the name of the first mode, color is used to
1942 highlight the changed parts in all modes if enabled.
1943
1944 --word-diff-regex=<regex>
1945 Use <regex> to decide what a word is, instead of considering runs
1946 of non-whitespace to be a word. Also implies --word-diff unless it
1947 was already enabled.
1948
1949 Every non-overlapping match of the <regex> is considered a word.
1950 Anything between these matches is considered whitespace and
1951 ignored(!) for the purposes of finding differences. You may want to
1952 append |[^[:space:]] to your regular expression to make sure that
1953 it matches all non-whitespace characters. A match that contains a
1954 newline is silently truncated(!) at the newline.
1955
1956 For example, --word-diff-regex=. will treat each character as a
1957 word and, correspondingly, show differences character by character.
1958
1959 The regex can also be set via a diff driver or configuration
1960 option, see gitattributes(5) or git-config(1). Giving it explicitly
1961 overrides any diff driver or configuration setting. Diff drivers
1962 override configuration settings.
1963
1964 --color-words[=<regex>]
1965 Equivalent to --word-diff=color plus (if a regex was specified)
1966 --word-diff-regex=<regex>.
1967
1968 --no-renames
1969 Turn off rename detection, even when the configuration file gives
1970 the default to do so.
1971
1972 --[no-]rename-empty
1973 Whether to use empty blobs as rename source.
1974
1975 --check
1976 Warn if changes introduce conflict markers or whitespace errors.
1977 What are considered whitespace errors is controlled by
1978 core.whitespace configuration. By default, trailing whitespaces
1979 (including lines that consist solely of whitespaces) and a space
1980 character that is immediately followed by a tab character inside
1981 the initial indent of the line are considered whitespace errors.
1982 Exits with non-zero status if problems are found. Not compatible
1983 with --exit-code.
1984
1985 --ws-error-highlight=<kind>
1986 Highlight whitespace errors in the context, old or new lines of the
1987 diff. Multiple values are separated by comma, none resets previous
1988 values, default reset the list to new and all is a shorthand for
1989 old,new,context. When this option is not given, and the
1990 configuration variable diff.wsErrorHighlight is not set, only
1991 whitespace errors in new lines are highlighted. The whitespace
1992 errors are colored with color.diff.whitespace.
1993
1994 --full-index
1995 Instead of the first handful of characters, show the full pre- and
1996 post-image blob object names on the "index" line when generating
1997 patch format output.
1998
1999 --binary
2000 In addition to --full-index, output a binary diff that can be
2001 applied with git-apply. Implies --patch.
2002
2003 --abbrev[=<n>]
2004 Instead of showing the full 40-byte hexadecimal object name in
2005 diff-raw format output and diff-tree header lines, show the
2006 shortest prefix that is at least <n> hexdigits long that uniquely
2007 refers the object. In diff-patch output format, --full-index takes
2008 higher precedence, i.e. if --full-index is specified, full blob
2009 names will be shown regardless of --abbrev. Non default number of
2010 digits can be specified with --abbrev=<n>.
2011
2012 -B[<n>][/<m>], --break-rewrites[=[<n>][/<m>]]
2013 Break complete rewrite changes into pairs of delete and create.
2014 This serves two purposes:
2015
2016 It affects the way a change that amounts to a total rewrite of a
2017 file not as a series of deletion and insertion mixed together with
2018 a very few lines that happen to match textually as the context, but
2019 as a single deletion of everything old followed by a single
2020 insertion of everything new, and the number m controls this aspect
2021 of the -B option (defaults to 60%). -B/70% specifies that less
2022 than 30% of the original should remain in the result for Git to
2023 consider it a total rewrite (i.e. otherwise the resulting patch
2024 will be a series of deletion and insertion mixed together with
2025 context lines).
2026
2027 When used with -M, a totally-rewritten file is also considered as
2028 the source of a rename (usually -M only considers a file that
2029 disappeared as the source of a rename), and the number n controls
2030 this aspect of the -B option (defaults to 50%). -B20% specifies
2031 that a change with addition and deletion compared to 20% or more of
2032 the file’s size are eligible for being picked up as a possible
2033 source of a rename to another file.
2034
2035 -M[<n>], --find-renames[=<n>]
2036 If generating diffs, detect and report renames for each commit. For
2037 following files across renames while traversing history, see
2038 --follow. If n is specified, it is a threshold on the similarity
2039 index (i.e. amount of addition/deletions compared to the file’s
2040 size). For example, -M90% means Git should consider a delete/add
2041 pair to be a rename if more than 90% of the file hasn’t changed.
2042 Without a % sign, the number is to be read as a fraction, with a
2043 decimal point before it. I.e., -M5 becomes 0.5, and is thus the
2044 same as -M50%. Similarly, -M05 is the same as -M5%. To limit
2045 detection to exact renames, use -M100%. The default similarity
2046 index is 50%.
2047
2048 -C[<n>], --find-copies[=<n>]
2049 Detect copies as well as renames. See also --find-copies-harder. If
2050 n is specified, it has the same meaning as for -M<n>.
2051
2052 --find-copies-harder
2053 For performance reasons, by default, -C option finds copies only if
2054 the original file of the copy was modified in the same changeset.
2055 This flag makes the command inspect unmodified files as candidates
2056 for the source of copy. This is a very expensive operation for
2057 large projects, so use it with caution. Giving more than one -C
2058 option has the same effect.
2059
2060 -D, --irreversible-delete
2061 Omit the preimage for deletes, i.e. print only the header but not
2062 the diff between the preimage and /dev/null. The resulting patch is
2063 not meant to be applied with patch or git apply; this is solely for
2064 people who want to just concentrate on reviewing the text after the
2065 change. In addition, the output obviously lacks enough information
2066 to apply such a patch in reverse, even manually, hence the name of
2067 the option.
2068
2069 When used together with -B, omit also the preimage in the deletion
2070 part of a delete/create pair.
2071
2072 -l<num>
2073 The -M and -C options involve some preliminary steps that can
2074 detect subsets of renames/copies cheaply, followed by an exhaustive
2075 fallback portion that compares all remaining unpaired destinations
2076 to all relevant sources. (For renames, only remaining unpaired
2077 sources are relevant; for copies, all original sources are
2078 relevant.) For N sources and destinations, this exhaustive check is
2079 O(N^2). This option prevents the exhaustive portion of rename/copy
2080 detection from running if the number of source/destination files
2081 involved exceeds the specified number. Defaults to
2082 diff.renameLimit. Note that a value of 0 is treated as unlimited.
2083
2084 --diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]
2085 Select only files that are Added (A), Copied (C), Deleted (D),
2086 Modified (M), Renamed (R), have their type (i.e. regular file,
2087 symlink, submodule, ...) changed (T), are Unmerged (U), are Unknown
2088 (X), or have had their pairing Broken (B). Any combination of the
2089 filter characters (including none) can be used. When *
2090 (All-or-none) is added to the combination, all paths are selected
2091 if there is any file that matches other criteria in the comparison;
2092 if there is no file that matches other criteria, nothing is
2093 selected.
2094
2095 Also, these upper-case letters can be downcased to exclude. E.g.
2096 --diff-filter=ad excludes added and deleted paths.
2097
2098 Note that not all diffs can feature all types. For instance, copied
2099 and renamed entries cannot appear if detection for those types is
2100 disabled.
2101
2102 -S<string>
2103 Look for differences that change the number of occurrences of the
2104 specified string (i.e. addition/deletion) in a file. Intended for
2105 the scripter’s use.
2106
2107 It is useful when you’re looking for an exact block of code (like a
2108 struct), and want to know the history of that block since it first
2109 came into being: use the feature iteratively to feed the
2110 interesting block in the preimage back into -S, and keep going
2111 until you get the very first version of the block.
2112
2113 Binary files are searched as well.
2114
2115 -G<regex>
2116 Look for differences whose patch text contains added/removed lines
2117 that match <regex>.
2118
2119 To illustrate the difference between -S<regex> --pickaxe-regex and
2120 -G<regex>, consider a commit with the following diff in the same
2121 file:
2122
2123 + return frotz(nitfol, two->ptr, 1, 0);
2124 ...
2125 - hit = frotz(nitfol, mf2.ptr, 1, 0);
2126
2127 While git log -G"frotz\(nitfol" will show this commit, git log
2128 -S"frotz\(nitfol" --pickaxe-regex will not (because the number of
2129 occurrences of that string did not change).
2130
2131 Unless --text is supplied patches of binary files without a
2132 textconv filter will be ignored.
2133
2134 See the pickaxe entry in gitdiffcore(7) for more information.
2135
2136 --find-object=<object-id>
2137 Look for differences that change the number of occurrences of the
2138 specified object. Similar to -S, just the argument is different in
2139 that it doesn’t search for a specific string but for a specific
2140 object id.
2141
2142 The object can be a blob or a submodule commit. It implies the -t
2143 option in git-log to also find trees.
2144
2145 --pickaxe-all
2146 When -S or -G finds a change, show all the changes in that
2147 changeset, not just the files that contain the change in <string>.
2148
2149 --pickaxe-regex
2150 Treat the <string> given to -S as an extended POSIX regular
2151 expression to match.
2152
2153 -O<orderfile>
2154 Control the order in which files appear in the output. This
2155 overrides the diff.orderFile configuration variable (see git-
2156 config(1)). To cancel diff.orderFile, use -O/dev/null.
2157
2158 The output order is determined by the order of glob patterns in
2159 <orderfile>. All files with pathnames that match the first pattern
2160 are output first, all files with pathnames that match the second
2161 pattern (but not the first) are output next, and so on. All files
2162 with pathnames that do not match any pattern are output last, as if
2163 there was an implicit match-all pattern at the end of the file. If
2164 multiple pathnames have the same rank (they match the same pattern
2165 but no earlier patterns), their output order relative to each other
2166 is the normal order.
2167
2168 <orderfile> is parsed as follows:
2169
2170 • Blank lines are ignored, so they can be used as separators for
2171 readability.
2172
2173 • Lines starting with a hash ("#") are ignored, so they can be
2174 used for comments. Add a backslash ("\") to the beginning of
2175 the pattern if it starts with a hash.
2176
2177 • Each other line contains a single pattern.
2178
2179 Patterns have the same syntax and semantics as patterns used for
2180 fnmatch(3) without the FNM_PATHNAME flag, except a pathname also
2181 matches a pattern if removing any number of the final pathname
2182 components matches the pattern. For example, the pattern "foo*bar"
2183 matches "fooasdfbar" and "foo/bar/baz/asdf" but not "foobarx".
2184
2185 --skip-to=<file>, --rotate-to=<file>
2186 Discard the files before the named <file> from the output (i.e.
2187 skip to), or move them to the end of the output (i.e. rotate to).
2188 These were invented primarily for use of the git difftool command,
2189 and may not be very useful otherwise.
2190
2191 -R
2192 Swap two inputs; that is, show differences from index or on-disk
2193 file to tree contents.
2194
2195 --relative[=<path>], --no-relative
2196 When run from a subdirectory of the project, it can be told to
2197 exclude changes outside the directory and show pathnames relative
2198 to it with this option. When you are not in a subdirectory (e.g. in
2199 a bare repository), you can name which subdirectory to make the
2200 output relative to by giving a <path> as an argument.
2201 --no-relative can be used to countermand both diff.relative config
2202 option and previous --relative.
2203
2204 -a, --text
2205 Treat all files as text.
2206
2207 --ignore-cr-at-eol
2208 Ignore carriage-return at the end of line when doing a comparison.
2209
2210 --ignore-space-at-eol
2211 Ignore changes in whitespace at EOL.
2212
2213 -b, --ignore-space-change
2214 Ignore changes in amount of whitespace. This ignores whitespace at
2215 line end, and considers all other sequences of one or more
2216 whitespace characters to be equivalent.
2217
2218 -w, --ignore-all-space
2219 Ignore whitespace when comparing lines. This ignores differences
2220 even if one line has whitespace where the other line has none.
2221
2222 --ignore-blank-lines
2223 Ignore changes whose lines are all blank.
2224
2225 -I<regex>, --ignore-matching-lines=<regex>
2226 Ignore changes whose all lines match <regex>. This option may be
2227 specified more than once.
2228
2229 --inter-hunk-context=<lines>
2230 Show the context between diff hunks, up to the specified number of
2231 lines, thereby fusing hunks that are close to each other. Defaults
2232 to diff.interHunkContext or 0 if the config option is unset.
2233
2234 -W, --function-context
2235 Show whole function as context lines for each change. The function
2236 names are determined in the same way as git diff works out patch
2237 hunk headers (see Defining a custom hunk-header in
2238 gitattributes(5)).
2239
2240 --ext-diff
2241 Allow an external diff helper to be executed. If you set an
2242 external diff driver with gitattributes(5), you need to use this
2243 option with git-log(1) and friends.
2244
2245 --no-ext-diff
2246 Disallow external diff drivers.
2247
2248 --textconv, --no-textconv
2249 Allow (or disallow) external text conversion filters to be run when
2250 comparing binary files. See gitattributes(5) for details. Because
2251 textconv filters are typically a one-way conversion, the resulting
2252 diff is suitable for human consumption, but cannot be applied. For
2253 this reason, textconv filters are enabled by default only for git-
2254 diff(1) and git-log(1), but not for git-format-patch(1) or diff
2255 plumbing commands.
2256
2257 --ignore-submodules[=<when>]
2258 Ignore changes to submodules in the diff generation. <when> can be
2259 either "none", "untracked", "dirty" or "all", which is the default.
2260 Using "none" will consider the submodule modified when it either
2261 contains untracked or modified files or its HEAD differs from the
2262 commit recorded in the superproject and can be used to override any
2263 settings of the ignore option in git-config(1) or gitmodules(5).
2264 When "untracked" is used submodules are not considered dirty when
2265 they only contain untracked content (but they are still scanned for
2266 modified content). Using "dirty" ignores all changes to the work
2267 tree of submodules, only changes to the commits stored in the
2268 superproject are shown (this was the behavior until 1.7.0). Using
2269 "all" hides all changes to submodules.
2270
2271 --src-prefix=<prefix>
2272 Show the given source prefix instead of "a/".
2273
2274 --dst-prefix=<prefix>
2275 Show the given destination prefix instead of "b/".
2276
2277 --no-prefix
2278 Do not show any source or destination prefix.
2279
2280 --line-prefix=<prefix>
2281 Prepend an additional prefix to every line of output.
2282
2283 --ita-invisible-in-index
2284 By default entries added by "git add -N" appear as an existing
2285 empty file in "git diff" and a new file in "git diff --cached".
2286 This option makes the entry appear as a new file in "git diff" and
2287 non-existent in "git diff --cached". This option could be reverted
2288 with --ita-visible-in-index. Both options are experimental and
2289 could be removed in future.
2290
2291 For more detailed explanation on these common options, see also
2292 gitdiffcore(7).
2293
2295 Running git-diff(1), git-log(1), git-show(1), git-diff-index(1), git-
2296 diff-tree(1), or git-diff-files(1) with the -p option produces patch
2297 text. You can customize the creation of patch text via the
2298 GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables (see
2299 git(1)), and the diff attribute (see gitattributes(5)).
2300
2301 What the -p option produces is slightly different from the traditional
2302 diff format:
2303
2304 1. It is preceded with a "git diff" header that looks like this:
2305
2306 diff --git a/file1 b/file2
2307
2308 The a/ and b/ filenames are the same unless rename/copy is
2309 involved. Especially, even for a creation or a deletion, /dev/null
2310 is not used in place of the a/ or b/ filenames.
2311
2312 When rename/copy is involved, file1 and file2 show the name of the
2313 source file of the rename/copy and the name of the file that
2314 rename/copy produces, respectively.
2315
2316 2. It is followed by one or more extended header lines:
2317
2318 old mode <mode>
2319 new mode <mode>
2320 deleted file mode <mode>
2321 new file mode <mode>
2322 copy from <path>
2323 copy to <path>
2324 rename from <path>
2325 rename to <path>
2326 similarity index <number>
2327 dissimilarity index <number>
2328 index <hash>..<hash> <mode>
2329
2330 File modes are printed as 6-digit octal numbers including the file
2331 type and file permission bits.
2332
2333 Path names in extended headers do not include the a/ and b/
2334 prefixes.
2335
2336 The similarity index is the percentage of unchanged lines, and the
2337 dissimilarity index is the percentage of changed lines. It is a
2338 rounded down integer, followed by a percent sign. The similarity
2339 index value of 100% is thus reserved for two equal files, while
2340 100% dissimilarity means that no line from the old file made it
2341 into the new one.
2342
2343 The index line includes the blob object names before and after the
2344 change. The <mode> is included if the file mode does not change;
2345 otherwise, separate lines indicate the old and the new mode.
2346
2347 3. Pathnames with "unusual" characters are quoted as explained for the
2348 configuration variable core.quotePath (see git-config(1)).
2349
2350 4. All the file1 files in the output refer to files before the commit,
2351 and all the file2 files refer to files after the commit. It is
2352 incorrect to apply each change to each file sequentially. For
2353 example, this patch will swap a and b:
2354
2355 diff --git a/a b/b
2356 rename from a
2357 rename to b
2358 diff --git a/b b/a
2359 rename from b
2360 rename to a
2361
2362 5. Hunk headers mention the name of the function to which the hunk
2363 applies. See "Defining a custom hunk-header" in gitattributes(5)
2364 for details of how to tailor to this to specific languages.
2365
2367 Any diff-generating command can take the -c or --cc option to produce a
2368 combined diff when showing a merge. This is the default format when
2369 showing merges with git-diff(1) or git-show(1). Note also that you can
2370 give suitable --diff-merges option to any of these commands to force
2371 generation of diffs in specific format.
2372
2373 A "combined diff" format looks like this:
2374
2375 diff --combined describe.c
2376 index fabadb8,cc95eb0..4866510
2377 --- a/describe.c
2378 +++ b/describe.c
2379 @@@ -98,20 -98,12 +98,20 @@@
2380 return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
2381 }
2382
2383 - static void describe(char *arg)
2384 -static void describe(struct commit *cmit, int last_one)
2385 ++static void describe(char *arg, int last_one)
2386 {
2387 + unsigned char sha1[20];
2388 + struct commit *cmit;
2389 struct commit_list *list;
2390 static int initialized = 0;
2391 struct commit_name *n;
2392
2393 + if (get_sha1(arg, sha1) < 0)
2394 + usage(describe_usage);
2395 + cmit = lookup_commit_reference(sha1);
2396 + if (!cmit)
2397 + usage(describe_usage);
2398 +
2399 if (!initialized) {
2400 initialized = 1;
2401 for_each_ref(get_name);
2402
2403 1. It is preceded with a "git diff" header, that looks like this (when
2404 the -c option is used):
2405
2406 diff --combined file
2407
2408 or like this (when the --cc option is used):
2409
2410 diff --cc file
2411
2412 2. It is followed by one or more extended header lines (this example
2413 shows a merge with two parents):
2414
2415 index <hash>,<hash>..<hash>
2416 mode <mode>,<mode>..<mode>
2417 new file mode <mode>
2418 deleted file mode <mode>,<mode>
2419
2420 The mode <mode>,<mode>..<mode> line appears only if at least one of
2421 the <mode> is different from the rest. Extended headers with
2422 information about detected contents movement (renames and copying
2423 detection) are designed to work with diff of two <tree-ish> and are
2424 not used by combined diff format.
2425
2426 3. It is followed by two-line from-file/to-file header
2427
2428 --- a/file
2429 +++ b/file
2430
2431 Similar to two-line header for traditional unified diff format,
2432 /dev/null is used to signal created or deleted files.
2433
2434 However, if the --combined-all-paths option is provided, instead of
2435 a two-line from-file/to-file you get a N+1 line from-file/to-file
2436 header, where N is the number of parents in the merge commit
2437
2438 --- a/file
2439 --- a/file
2440 --- a/file
2441 +++ b/file
2442
2443 This extended format can be useful if rename or copy detection is
2444 active, to allow you to see the original name of the file in
2445 different parents.
2446
2447 4. Chunk header format is modified to prevent people from accidentally
2448 feeding it to patch -p1. Combined diff format was created for
2449 review of merge commit changes, and was not meant to be applied.
2450 The change is similar to the change in the extended index header:
2451
2452 @@@ <from-file-range> <from-file-range> <to-file-range> @@@
2453
2454 There are (number of parents + 1) @ characters in the chunk header
2455 for combined diff format.
2456
2457 Unlike the traditional unified diff format, which shows two files A and
2458 B with a single column that has - (minus — appears in A but removed in
2459 B), + (plus — missing in A but added to B), or " " (space — unchanged)
2460 prefix, this format compares two or more files file1, file2,... with
2461 one file X, and shows how X differs from each of fileN. One column for
2462 each of fileN is prepended to the output line to note how X’s line is
2463 different from it.
2464
2465 A - character in the column N means that the line appears in fileN but
2466 it does not appear in the result. A + character in the column N means
2467 that the line appears in the result, and fileN does not have that line
2468 (in other words, the line was added, from the point of view of that
2469 parent).
2470
2471 In the above example output, the function signature was changed from
2472 both files (hence two - removals from both file1 and file2, plus ++ to
2473 mean one line that was added does not appear in either file1 or file2).
2474 Also eight other lines are the same from file1 but do not appear in
2475 file2 (hence prefixed with +).
2476
2477 When shown by git diff-tree -c, it compares the parents of a merge
2478 commit with the merge result (i.e. file1..fileN are the parents). When
2479 shown by git diff-files -c, it compares the two unresolved merge
2480 parents with the working tree file (i.e. file1 is stage 2 aka "our
2481 version", file2 is stage 3 aka "their version").
2482
2484 git log --no-merges
2485 Show the whole commit history, but skip any merges
2486
2487 git log v2.6.12.. include/scsi drivers/scsi
2488 Show all commits since version v2.6.12 that changed any file in the
2489 include/scsi or drivers/scsi subdirectories
2490
2491 git log --since="2 weeks ago" -- gitk
2492 Show the changes during the last two weeks to the file gitk. The --
2493 is necessary to avoid confusion with the branch named gitk
2494
2495 git log --name-status release..test
2496 Show the commits that are in the "test" branch but not yet in the
2497 "release" branch, along with the list of paths each commit
2498 modifies.
2499
2500 git log --follow builtin/rev-list.c
2501 Shows the commits that changed builtin/rev-list.c, including those
2502 commits that occurred before the file was given its present name.
2503
2504 git log --branches --not --remotes=origin
2505 Shows all commits that are in any of local branches but not in any
2506 of remote-tracking branches for origin (what you have that origin
2507 doesn’t).
2508
2509 git log master --not --remotes=*/master
2510 Shows all commits that are in local master but not in any remote
2511 repository master branches.
2512
2513 git log -p -m --first-parent
2514 Shows the history including change diffs, but only from the “main
2515 branch” perspective, skipping commits that come from merged
2516 branches, and showing full diffs of changes introduced by the
2517 merges. This makes sense only when following a strict policy of
2518 merging all topic branches when staying on a single integration
2519 branch.
2520
2521 git log -L '/int main/',/^}/:main.c
2522 Shows how the function main() in the file main.c evolved over time.
2523
2524 git log -3
2525 Limits the number of commits to show to 3.
2526
2528 Git is to some extent character encoding agnostic.
2529
2530 • The contents of the blob objects are uninterpreted sequences of
2531 bytes. There is no encoding translation at the core level.
2532
2533 • Path names are encoded in UTF-8 normalization form C. This applies
2534 to tree objects, the index file, ref names, as well as path names
2535 in command line arguments, environment variables and config files
2536 (.git/config (see git-config(1)), gitignore(5), gitattributes(5)
2537 and gitmodules(5)).
2538
2539 Note that Git at the core level treats path names simply as
2540 sequences of non-NUL bytes, there are no path name encoding
2541 conversions (except on Mac and Windows). Therefore, using non-ASCII
2542 path names will mostly work even on platforms and file systems that
2543 use legacy extended ASCII encodings. However, repositories created
2544 on such systems will not work properly on UTF-8-based systems (e.g.
2545 Linux, Mac, Windows) and vice versa. Additionally, many Git-based
2546 tools simply assume path names to be UTF-8 and will fail to display
2547 other encodings correctly.
2548
2549 • Commit log messages are typically encoded in UTF-8, but other
2550 extended ASCII encodings are also supported. This includes
2551 ISO-8859-x, CP125x and many others, but not UTF-16/32, EBCDIC and
2552 CJK multi-byte encodings (GBK, Shift-JIS, Big5, EUC-x, CP9xx etc.).
2553
2554 Although we encourage that the commit log messages are encoded in
2555 UTF-8, both the core and Git Porcelain are designed not to force UTF-8
2556 on projects. If all participants of a particular project find it more
2557 convenient to use legacy encodings, Git does not forbid it. However,
2558 there are a few things to keep in mind.
2559
2560 1. git commit and git commit-tree issues a warning if the commit log
2561 message given to it does not look like a valid UTF-8 string, unless
2562 you explicitly say your project uses a legacy encoding. The way to
2563 say this is to have i18n.commitEncoding in .git/config file, like
2564 this:
2565
2566 [i18n]
2567 commitEncoding = ISO-8859-1
2568
2569 Commit objects created with the above setting record the value of
2570 i18n.commitEncoding in its encoding header. This is to help other
2571 people who look at them later. Lack of this header implies that the
2572 commit log message is encoded in UTF-8.
2573
2574 2. git log, git show, git blame and friends look at the encoding
2575 header of a commit object, and try to re-code the log message into
2576 UTF-8 unless otherwise specified. You can specify the desired
2577 output encoding with i18n.logOutputEncoding in .git/config file,
2578 like this:
2579
2580 [i18n]
2581 logOutputEncoding = ISO-8859-1
2582
2583 If you do not have this configuration variable, the value of
2584 i18n.commitEncoding is used instead.
2585
2586 Note that we deliberately chose not to re-code the commit log message
2587 when a commit is made to force UTF-8 at the commit object level,
2588 because re-coding to UTF-8 is not necessarily a reversible operation.
2589
2591 See git-config(1) for core variables and git-diff(1) for settings
2592 related to diff generation.
2593
2594 format.pretty
2595 Default for the --format option. (See Pretty Formats above.)
2596 Defaults to medium.
2597
2598 i18n.logOutputEncoding
2599 Encoding to use when displaying logs. (See Discussion above.)
2600 Defaults to the value of i18n.commitEncoding if set, and UTF-8
2601 otherwise.
2602
2603 log.date
2604 Default format for human-readable dates. (Compare the --date
2605 option.) Defaults to "default", which means to write dates like Sat
2606 May 8 19:35:34 2010 -0500.
2607
2608 If the format is set to "auto:foo" and the pager is in use, format
2609 "foo" will be the used for the date format. Otherwise "default"
2610 will be used.
2611
2612 log.follow
2613 If true, git log will act as if the --follow option was used when a
2614 single <path> is given. This has the same limitations as --follow,
2615 i.e. it cannot be used to follow multiple files and does not work
2616 well on non-linear history.
2617
2618 log.showRoot
2619 If false, git log and related commands will not treat the initial
2620 commit as a big creation event. Any root commits in git log -p
2621 output would be shown without a diff attached. The default is true.
2622
2623 log.showSignature
2624 If true, git log and related commands will act as if the
2625 --show-signature option was passed to them.
2626
2627 mailmap.*
2628 See git-shortlog(1).
2629
2630 notes.displayRef
2631 Which refs, in addition to the default set by core.notesRef or
2632 GIT_NOTES_REF, to read notes from when showing commit messages with
2633 the log family of commands. See git-notes(1).
2634
2635 May be an unabbreviated ref name or a glob and may be specified
2636 multiple times. A warning will be issued for refs that do not
2637 exist, but a glob that does not match any refs is silently ignored.
2638
2639 This setting can be disabled by the --no-notes option, overridden
2640 by the GIT_NOTES_DISPLAY_REF environment variable, and overridden
2641 by the --notes=<ref> option.
2642
2644 Part of the git(1) suite
2645
2646
2647
2648Git 2.36.1 2022-05-05 GIT-LOG(1)