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