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