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