1GIT-LOG(1)                        Git Manual                        GIT-LOG(1)
2
3
4

NAME

6       git-log - Show commit logs
7

SYNOPSIS

9       git log [<options>] [<since>..<until>] [[--] <path>...]
10

DESCRIPTION

12       Shows the commit logs.
13
14       The command takes options applicable to the git rev-list command to
15       control what is shown and how, and options applicable to the git diff-*
16       commands to control how the changes each commit introduces are shown.
17

OPTIONS

19       -p, -u
20           Generate patch (see section on generating patches).
21
22       -U<n>, --unified=<n>
23           Generate diffs with <n> lines of context instead of the usual
24           three. Implies -p.
25
26       --raw
27           Generate the raw format.
28
29       --patch-with-raw
30           Synonym for -p --raw.
31
32       --patience
33           Generate a diff using the "patience diff" algorithm.
34
35       --stat[=width[,name-width]]
36           Generate a diffstat. You can override the default output width for
37           80-column terminal by --stat=width. The width of the filename part
38           can be controlled by giving another width to it separated by a
39           comma.
40
41       --numstat
42           Similar to --stat, but shows number of added and deleted lines in
43           decimal notation and pathname without abbreviation, to make it more
44           machine friendly. For binary files, outputs two - instead of saying
45           0 0.
46
47       --shortstat
48           Output only the last line of the --stat format containing total
49           number of modified files, as well as number of added and deleted
50           lines.
51
52       --dirstat[=limit]
53           Output the distribution of relative amount of changes (number of
54           lines added or removed) for each sub-directory. Directories with
55           changes below a cut-off percent (3% by default) are not shown. The
56           cut-off percent can be set with --dirstat=limit. Changes in a child
57           directory is not counted for the parent directory, unless
58           --cumulative is used.
59
60       --dirstat-by-file[=limit]
61           Same as --dirstat, but counts changed files instead of lines.
62
63       --summary
64           Output a condensed summary of extended header information such as
65           creations, renames and mode changes.
66
67       --patch-with-stat
68           Synonym for -p --stat.
69
70       -z
71           Separate the commits with NULs instead of with new newlines.
72
73           Also, when --raw or --numstat has been given, do not munge
74           pathnames and use NULs as output field terminators.
75
76           Without this option, each pathname output will have TAB, LF, double
77           quotes, and backslash characters replaced with \t, \n, \", and \\,
78           respectively, and the pathname will be enclosed in double quotes if
79           any of those replacements occurred.
80
81       --name-only
82           Show only names of changed files.
83
84       --name-status
85           Show only names and status of changed files. See the description of
86           the --diff-filter option on what the status letters mean.
87
88       --submodule[=<format>]
89           Chose the output format for submodule differences. <format> can be
90           one of short and log.  short just shows pairs of commit names, this
91           format is used when this option is not given.  log is the default
92           value for this option and lists the commits in that commit range
93           like the summary option of git-submodule(1) does.
94
95       --color[=<when>]
96           Show colored diff. The value must be always (the default), never,
97           or auto.
98
99       --no-color
100           Turn off colored diff, even when the configuration file gives the
101           default to color output. Same as --color=never.
102
103       --color-words[=<regex>]
104           Show colored word diff, i.e., color words which have changed. By
105           default, words are separated by whitespace.
106
107           When a <regex> is specified, every non-overlapping match of the
108           <regex> is considered a word. Anything between these matches is
109           considered whitespace and ignored(!) for the purposes of finding
110           differences. You may want to append |[^[:space:]] to your regular
111           expression to make sure that it matches all non-whitespace
112           characters. A match that contains a newline is silently
113           truncated(!) at the newline.
114
115           The regex can also be set via a diff driver or configuration
116           option, see gitattributes(1) or git-config(1). Giving it explicitly
117           overrides any diff driver or configuration setting. Diff drivers
118           override configuration settings.
119
120       --no-renames
121           Turn off rename detection, even when the configuration file gives
122           the default to do so.
123
124       --check
125           Warn if changes introduce trailing whitespace or an indent that
126           uses a space before a tab. Exits with non-zero status if problems
127           are found. Not compatible with --exit-code.
128
129       --full-index
130           Instead of the first handful of characters, show the full pre- and
131           post-image blob object names on the "index" line when generating
132           patch format output.
133
134       --binary
135           In addition to --full-index, output a binary diff that can be
136           applied with git-apply.
137
138       --abbrev[=<n>]
139           Instead of showing the full 40-byte hexadecimal object name in
140           diff-raw format output and diff-tree header lines, show only a
141           partial prefix. This is independent of the --full-index option
142           above, which controls the diff-patch output format. Non default
143           number of digits can be specified with --abbrev=<n>.
144
145       -B
146           Break complete rewrite changes into pairs of delete and create.
147
148       -M
149           Detect renames.
150
151       -C
152           Detect copies as well as renames. See also --find-copies-harder.
153
154       --diff-filter=[ACDMRTUXB*]
155           Select only files that are Added (A), Copied (C), Deleted (D),
156           Modified (M), Renamed (R), have their type (i.e. regular file,
157           symlink, submodule, ...) changed (T), are Unmerged (U), are Unknown
158           (X), or have had their pairing Broken (B). Any combination of the
159           filter characters may be used. When * (All-or-none) is added to the
160           combination, all paths are selected if there is any file that
161           matches other criteria in the comparison; if there is no file that
162           matches other criteria, nothing is selected.
163
164       --find-copies-harder
165           For performance reasons, by default, -C option finds copies only if
166           the original file of the copy was modified in the same changeset.
167           This flag makes the command inspect unmodified files as candidates
168           for the source of copy. This is a very expensive operation for
169           large projects, so use it with caution. Giving more than one -C
170           option has the same effect.
171
172       -l<num>
173           The -M and -C options require O(n^2) processing time where n is the
174           number of potential rename/copy targets. This option prevents
175           rename/copy detection from running if the number of rename/copy
176           targets exceeds the specified number.
177
178       -S<string>
179           Look for differences that introduce or remove an instance of
180           <string>. Note that this is different than the string simply
181           appearing in diff output; see the pickaxe entry in gitdiffcore(7)
182           for more details.
183
184       --pickaxe-all
185           When -S finds a change, show all the changes in that changeset, not
186           just the files that contain the change in <string>.
187
188       --pickaxe-regex
189           Make the <string> not a plain string but an extended POSIX regex to
190           match.
191
192       -O<orderfile>
193           Output the patch in the order specified in the <orderfile>, which
194           has one shell glob pattern per line.
195
196       -R
197           Swap two inputs; that is, show differences from index or on-disk
198           file to tree contents.
199
200       --relative[=<path>]
201           When run from a subdirectory of the project, it can be told to
202           exclude changes outside the directory and show pathnames relative
203           to it with this option. When you are not in a subdirectory (e.g. in
204           a bare repository), you can name which subdirectory to make the
205           output relative to by giving a <path> as an argument.
206
207       -a, --text
208           Treat all files as text.
209
210       --ignore-space-at-eol
211           Ignore changes in whitespace at EOL.
212
213       -b, --ignore-space-change
214           Ignore changes in amount of whitespace. This ignores whitespace at
215           line end, and considers all other sequences of one or more
216           whitespace characters to be equivalent.
217
218       -w, --ignore-all-space
219           Ignore whitespace when comparing lines. This ignores differences
220           even if one line has whitespace where the other line has none.
221
222       --inter-hunk-context=<lines>
223           Show the context between diff hunks, up to the specified number of
224           lines, thereby fusing hunks that are close to each other.
225
226       --exit-code
227           Make the program exit with codes similar to diff(1). That is, it
228           exits with 1 if there were differences and 0 means no differences.
229
230       --quiet
231           Disable all output of the program. Implies --exit-code.
232
233       --ext-diff
234           Allow an external diff helper to be executed. If you set an
235           external diff driver with gitattributes(5), you need to use this
236           option with git-log(1) and friends.
237
238       --no-ext-diff
239           Disallow external diff drivers.
240
241       --ignore-submodules
242           Ignore changes to submodules in the diff generation.
243
244       --src-prefix=<prefix>
245           Show the given source prefix instead of "a/".
246
247       --dst-prefix=<prefix>
248           Show the given destination prefix instead of "b/".
249
250       --no-prefix
251           Do not show any source or destination prefix.
252
253       For more detailed explanation on these common options, see also
254       gitdiffcore(7).
255
256       -<n>
257           Limits the number of commits to show.
258
259       <since>..<until>
260           Show only commits between the named two commits. When either
261           <since> or <until> is omitted, it defaults to HEAD, i.e. the tip of
262           the current branch. For a more complete list of ways to spell
263           <since> and <until>, see "SPECIFYING REVISIONS" section in git-rev-
264           parse(1).
265
266       --decorate[=short|full]
267           Print out the ref names of any commits that are shown. If short is
268           specified, the ref name prefixes refs/heads/, refs/tags/ and
269           refs/remotes/ will not be printed. If full is specified, the full
270           ref name (including prefix) will be printed. The default option is
271           short.
272
273       --source
274           Print out the ref name given on the command line by which each
275           commit was reached.
276
277       --full-diff
278           Without this flag, "git log -p <path>..." shows commits that touch
279           the specified paths, and diffs about the same specified paths. With
280           this, the full diff is shown for commits that touch the specified
281           paths; this means that "<path>..." limits only commits, and doesn’t
282           limit diff for those commits.
283
284       --follow
285           Continue listing the history of a file beyond renames.
286
287       --log-size
288           Before the log message print out its size in bytes. Intended mainly
289           for porcelain tools consumption. If git is unable to produce a
290           valid value size is set to zero. Note that only message is
291           considered, if also a diff is shown its size is not included.
292
293       [--] <path>...
294           Show only commits that affect any of the specified paths. To
295           prevent confusion with options and branch names, paths may need to
296           be prefixed with "-- " to separate them from options or refnames.
297
298   Commit Formatting
299       --pretty[=<format>], --format[=<format>]
300           Pretty-print the contents of the commit logs in a given format,
301           where <format> can be one of oneline, short, medium, full, fuller,
302           email, raw and format:<string>. When omitted, the format defaults
303           to medium.
304
305           Note: you can specify the default pretty format in the repository
306           configuration (see git-config(1)).
307
308       --abbrev-commit
309           Instead of showing the full 40-byte hexadecimal commit object name,
310           show only a partial prefix. Non default number of digits can be
311           specified with "--abbrev=<n>" (which also modifies diff output, if
312           it is displayed).
313
314           This should make "--pretty=oneline" a whole lot more readable for
315           people using 80-column terminals.
316
317       --oneline
318           This is a shorthand for "--pretty=oneline --abbrev-commit" used
319           together.
320
321       --encoding[=<encoding>]
322           The commit objects record the encoding used for the log message in
323           their encoding header; this option can be used to tell the command
324           to re-code the commit log message in the encoding preferred by the
325           user. For non plumbing commands this defaults to UTF-8.
326
327       --no-notes, --show-notes[=<ref>]
328           Show the notes (see git-notes(1)) that annotate the commit, when
329           showing the commit log message. This is the default for git log,
330           git show and git whatchanged commands when there is no --pretty,
331           --format nor --oneline option is given on the command line.
332
333           With an optional argument, add this ref to the list of notes. The
334           ref is taken to be in refs/notes/ if it is not qualified.
335
336       --[no-]standard-notes
337           Enable or disable populating the notes ref list from the
338           core.notesRef and notes.displayRef variables (or corresponding
339           environment overrides). Enabled by default. See git-config(1).
340
341       --relative-date
342           Synonym for --date=relative.
343
344       --date={relative,local,default,iso,rfc,short,raw}
345           Only takes effect for dates shown in human-readable format, such as
346           when using "--pretty".  log.date config variable sets a default
347           value for log command’s --date option.
348
349           --date=relative shows dates relative to the current time, e.g. "2
350           hours ago".
351
352           --date=local shows timestamps in user’s local timezone.
353
354           --date=iso (or --date=iso8601) shows timestamps in ISO 8601 format.
355
356           --date=rfc (or --date=rfc2822) shows timestamps in RFC 2822 format,
357           often found in E-mail messages.
358
359           --date=short shows only date but not time, in YYYY-MM-DD format.
360
361           --date=raw shows the date in the internal raw git format %s %z
362           format.
363
364           --date=default shows timestamps in the original timezone (either
365           committer’s or author’s).
366
367       --parents
368           Print the parents of the commit. Also enables parent rewriting, see
369           History Simplification below.
370
371       --children
372           Print the children of the commit. Also enables parent rewriting,
373           see History Simplification below.
374
375       --left-right
376           Mark which side of a symmetric diff a commit is reachable from.
377           Commits from the left side are prefixed with < and those from the
378           right with >. If combined with --boundary, those commits are
379           prefixed with -.
380
381           For example, if you have this topology:
382
383                            y---b---b  branch B
384                           / \ /
385                          /   .
386                         /   / \
387                        o---x---a---a  branch A
388
389           you would get an output like this:
390
391                       $ git rev-list --left-right --boundary --pretty=oneline A...B
392
393                       >bbbbbbb... 3rd on b
394                       >bbbbbbb... 2nd on b
395                       <aaaaaaa... 3rd on a
396                       <aaaaaaa... 2nd on a
397                       -yyyyyyy... 1st on b
398                       -xxxxxxx... 1st on a
399
400
401       --graph
402           Draw a text-based graphical representation of the commit history on
403           the left hand side of the output. This may cause extra lines to be
404           printed in between commits, in order for the graph history to be
405           drawn properly.
406
407           This implies the --topo-order option by default, but the
408           --date-order option may also be specified.
409
410   Diff Formatting
411       Below are listed options that control the formatting of diff output.
412       Some of them are specific to git-rev-list(1), however other diff
413       options may be given. See git-diff-files(1) for more options.
414
415       -c
416           With this option, diff output for a merge commit shows the
417           differences from each of the parents to the merge result
418           simultaneously instead of showing pairwise diff between a parent
419           and the result one at a time. Furthermore, it lists only files
420           which were modified from all parents.
421
422       --cc
423           This flag implies the -c options and further compresses the patch
424           output by omitting uninteresting hunks whose contents in the
425           parents have only two variants and the merge result picks one of
426           them without modification.
427
428       -m
429           This flag makes the merge commits show the full diff like regular
430           commits; for each merge parent, a separate log entry and diff is
431           generated. An exception is that only diff against the first parent
432           is shown when --first-parent option is given; in that case, the
433           output represents the changes the merge brought into the
434           then-current branch.
435
436       -r
437           Show recursive diffs.
438
439       -t
440           Show the tree objects in the diff output. This implies -r.
441
442   Commit Limiting
443       Besides specifying a range of commits that should be listed using the
444       special notations explained in the description, additional commit
445       limiting may be applied.
446
447       -n number, --max-count=<number>
448           Limit the number of commits output.
449
450       --skip=<number>
451           Skip number commits before starting to show the commit output.
452
453       --since=<date>, --after=<date>
454           Show commits more recent than a specific date.
455
456       --until=<date>, --before=<date>
457           Show commits older than a specific date.
458
459       --author=<pattern>, --committer=<pattern>
460           Limit the commits output to ones with author/committer header lines
461           that match the specified pattern (regular expression).
462
463       --grep=<pattern>
464           Limit the commits output to ones with log message that matches the
465           specified pattern (regular expression).
466
467       --all-match
468           Limit the commits output to ones that match all given --grep,
469           --author and --committer instead of ones that match at least one.
470
471       -i, --regexp-ignore-case
472           Match the regexp limiting patterns without regard to letters case.
473
474       -E, --extended-regexp
475           Consider the limiting patterns to be extended regular expressions
476           instead of the default basic regular expressions.
477
478       -F, --fixed-strings
479           Consider the limiting patterns to be fixed strings (don’t interpret
480           pattern as a regular expression).
481
482       --remove-empty
483           Stop when a given path disappears from the tree.
484
485       --merges
486           Print only merge commits.
487
488       --no-merges
489           Do not print commits with more than one parent.
490
491       --first-parent
492           Follow only the first parent commit upon seeing a merge commit.
493           This option can give a better overview when viewing the evolution
494           of a particular topic branch, because merges into a topic branch
495           tend to be only about adjusting to updated upstream from time to
496           time, and this option allows you to ignore the individual commits
497           brought in to your history by such a merge.
498
499       --not
500           Reverses the meaning of the ^ prefix (or lack thereof) for all
501           following revision specifiers, up to the next --not.
502
503       --all
504           Pretend as if all the refs in refs/ are listed on the command line
505           as <commit>.
506
507       --branches[=pattern]
508           Pretend as if all the refs in refs/heads are listed on the command
509           line as <commit>. If pattern is given, limit branches to ones
510           matching given shell glob. If pattern lacks ?, , or [, / at the end
511           is implied.
512
513       --tags[=pattern]
514           Pretend as if all the refs in refs/tags are listed on the command
515           line as <commit>. If pattern is given, limit tags to ones matching
516           given shell glob. If pattern lacks ?, , or [, / at the end is
517           implied.
518
519       --remotes[=pattern]
520           Pretend as if all the refs in refs/remotes are listed on the
521           command line as <commit>. If `pattern`is given, limit remote
522           tracking branches to ones matching given shell glob. If pattern
523           lacks ?, , or [, / at the end is implied.
524
525       --glob=glob-pattern
526           Pretend as if all the refs matching shell glob glob-pattern are
527           listed on the command line as <commit>. Leading refs/, is
528           automatically prepended if missing. If pattern lacks ?, , or [, /
529           at the end is implied.
530
531       --bisect
532           Pretend as if the bad bisection ref refs/bisect/bad was listed and
533           as if it was followed by --not and the good bisection refs
534           refs/bisect/good-* on the command line.
535
536       --stdin
537           In addition to the <commit> listed on the command line, read them
538           from the standard input. If a -- separator is seen, stop reading
539           commits and start reading paths to limit the result.
540
541       --cherry-pick
542           Omit any commit that introduces the same change as another commit
543           on the "other side" when the set of commits are limited with
544           symmetric difference.
545
546           For example, if you have two branches, A and B, a usual way to list
547           all commits on only one side of them is with --left-right, like the
548           example above in the description of that option. It however shows
549           the commits that were cherry-picked from the other branch (for
550           example, "3rd on b" may be cherry-picked from branch A). With this
551           option, such pairs of commits are excluded from the output.
552
553       -g, --walk-reflogs
554           Instead of walking the commit ancestry chain, walk reflog entries
555           from the most recent one to older ones. When this option is used
556           you cannot specify commits to exclude (that is, ^commit,
557           commit1..commit2, nor commit1...commit2 notations cannot be used).
558
559           With --pretty format other than oneline (for obvious reasons), this
560           causes the output to have two extra lines of information taken from
561           the reflog. By default, commit@{Nth} notation is used in the
562           output. When the starting commit is specified as commit@{now},
563           output also uses commit@{timestamp} notation instead. Under
564           --pretty=oneline, the commit message is prefixed with this
565           information on the same line. This option cannot be combined with
566           --reverse. See also git-reflog(1).
567
568       --merge
569           After a failed merge, show refs that touch files having a conflict
570           and don’t exist on all heads to merge.
571
572       --boundary
573           Output uninteresting commits at the boundary, which are usually not
574           shown.
575
576   History Simplification
577       Sometimes you are only interested in parts of the history, for example
578       the commits modifying a particular <path>. But there are two parts of
579       History Simplification, one part is selecting the commits and the other
580       is how to do it, as there are various strategies to simplify the
581       history.
582
583       The following options select the commits to be shown:
584
585       <paths>
586           Commits modifying the given <paths> are selected.
587
588       --simplify-by-decoration
589           Commits that are referred by some branch or tag are selected.
590
591       Note that extra commits can be shown to give a meaningful history.
592
593       The following options affect the way the simplification is performed:
594
595       Default mode
596           Simplifies the history to the simplest history explaining the final
597           state of the tree. Simplest because it prunes some side branches if
598           the end result is the same (i.e. merging branches with the same
599           content)
600
601       --full-history
602           As the default mode but does not prune some history.
603
604       --dense
605           Only the selected commits are shown, plus some to have a meaningful
606           history.
607
608       --sparse
609           All commits in the simplified history are shown.
610
611       --simplify-merges
612           Additional option to --full-history to remove some needless merges
613           from the resulting history, as there are no selected commits
614           contributing to this merge.
615
616       A more detailed explanation follows.
617
618       Suppose you specified foo as the <paths>. We shall call commits that
619       modify foo !TREESAME, and the rest TREESAME. (In a diff filtered for
620       foo, they look different and equal, respectively.)
621
622       In the following, we will always refer to the same example history to
623       illustrate the differences between simplification settings. We assume
624       that you are filtering for a file foo in this commit graph:
625
626                     .-A---M---N---O---P
627                    /     /   /   /   /
628                   I     B   C   D   E
629                    \   /   /   /   /
630                     `-------------´
631
632
633       The horizontal line of history A—P is taken to be the first parent of
634       each merge. The commits are:
635
636       ·    I is the initial commit, in which foo exists with contents "asdf",
637           and a file quux exists with contents "quux". Initial commits are
638           compared to an empty tree, so I is !TREESAME.
639
640       ·   In A, foo contains just "foo".
641
642       ·    B contains the same change as A. Its merge M is trivial and hence
643           TREESAME to all parents.
644
645       ·    C does not change foo, but its merge N changes it to "foobar", so
646           it is not TREESAME to any parent.
647
648       ·    D sets foo to "baz". Its merge O combines the strings from N and D
649           to "foobarbaz"; i.e., it is not TREESAME to any parent.
650
651       ·    E changes quux to "xyzzy", and its merge P combines the strings to
652           "quux xyzzy". Despite appearing interesting, P is TREESAME to all
653           parents.
654
655       rev-list walks backwards through history, including or excluding
656       commits based on whether --full-history and/or parent rewriting (via
657       --parents or --children) are used. The following settings are
658       available.
659
660       Default mode
661           Commits are included if they are not TREESAME to any parent (though
662           this can be changed, see --sparse below). If the commit was a
663           merge, and it was TREESAME to one parent, follow only that parent.
664           (Even if there are several TREESAME parents, follow only one of
665           them.) Otherwise, follow all parents.
666
667           This results in:
668
669                         .-A---N---O
670                        /         /
671                       I---------D
672
673           Note how the rule to only follow the TREESAME parent, if one is
674           available, removed B from consideration entirely.  C was considered
675           via N, but is TREESAME. Root commits are compared to an empty tree,
676           so I is !TREESAME.
677
678           Parent/child relations are only visible with --parents, but that
679           does not affect the commits selected in default mode, so we have
680           shown the parent lines.
681
682       --full-history without parent rewriting
683           This mode differs from the default in one point: always follow all
684           parents of a merge, even if it is TREESAME to one of them. Even if
685           more than one side of the merge has commits that are included, this
686           does not imply that the merge itself is! In the example, we get
687
688                       I  A  B  N  D  O
689
690           P and M were excluded because they are TREESAME to a parent.  E, C
691           and B were all walked, but only B was !TREESAME, so the others do
692           not appear.
693
694           Note that without parent rewriting, it is not really possible to
695           talk about the parent/child relationships between the commits, so
696           we show them disconnected.
697
698       --full-history with parent rewriting
699           Ordinary commits are only included if they are !TREESAME (though
700           this can be changed, see --sparse below).
701
702           Merges are always included. However, their parent list is
703           rewritten: Along each parent, prune away commits that are not
704           included themselves. This results in
705
706                         .-A---M---N---O---P
707                        /     /   /   /   /
708                       I     B   /   D   /
709                        \   /   /   /   /
710                         `-------------´
711
712           Compare to --full-history without rewriting above. Note that E was
713           pruned away because it is TREESAME, but the parent list of P was
714           rewritten to contain E´s parent I. The same happened for C and N.
715           Note also that P was included despite being TREESAME.
716
717       In addition to the above settings, you can change whether TREESAME
718       affects inclusion:
719
720       --dense
721           Commits that are walked are included if they are not TREESAME to
722           any parent.
723
724       --sparse
725           All commits that are walked are included.
726
727           Note that without --full-history, this still simplifies merges: if
728           one of the parents is TREESAME, we follow only that one, so the
729           other sides of the merge are never walked.
730
731       Finally, there is a fourth simplification mode available:
732
733       --simplify-merges
734           First, build a history graph in the same way that --full-history
735           with parent rewriting does (see above).
736
737           Then simplify each commit ‘C` to its replacement C’ in the final
738           history according to the following rules:
739
740           ·   Set ‘C’` to C.
741
742           ·   Replace each parent ‘P` of C’ with its simplification ‘P’`. In
743               the process, drop parents that are ancestors of other parents,
744               and remove duplicates.
745
746           ·   If after this parent rewriting, ‘C’` is a root or merge commit
747               (has zero or >1 parents), a boundary commit, or !TREESAME, it
748               remains. Otherwise, it is replaced with its only parent.
749               The effect of this is best shown by way of comparing to
750               --full-history with parent rewriting. The example turns into:
751
752                             .-A---M---N---O
753                            /     /       /
754                           I     B       D
755                            \   /       /
756                             `---------´
757
758               Note the major differences in N and P over --full-history:
759
760               ·    N´s parent list had I removed, because it is an ancestor
761                   of the other parent M. Still, N remained because it is
762                   !TREESAME.
763
764               ·    P´s parent list similarly had I removed.  P was then
765                   removed completely, because it had one parent and is
766                   TREESAME.
767
768           The --simplify-by-decoration option allows you to view only the big
769           picture of the topology of the history, by omitting commits that
770           are not referenced by tags. Commits are marked as !TREESAME (in
771           other words, kept after history simplification rules described
772           above) if (1) they are referenced by tags, or (2) they change the
773           contents of the paths given on the command line. All other commits
774           are marked as TREESAME (subject to be simplified away).
775
776   Commit Ordering
777       By default, the commits are shown in reverse chronological order.
778
779       --topo-order
780           This option makes them appear in topological order (i.e. descendant
781           commits are shown before their parents).
782
783       --date-order
784           This option is similar to --topo-order in the sense that no parent
785           comes before all of its children, but otherwise things are still
786           ordered in the commit timestamp order.
787
788       --reverse
789           Output the commits in reverse order. Cannot be combined with
790           --walk-reflogs.
791
792   Object Traversal
793       These options are mostly targeted for packing of git repositories.
794
795       --objects
796           Print the object IDs of any object referenced by the listed
797           commits.  --objects foo ^bar thus means "send me all object IDs
798           which I need to download if I have the commit object bar, but not
799           foo".
800
801       --objects-edge
802           Similar to --objects, but also print the IDs of excluded commits
803           prefixed with a "-" character. This is used by git-pack-objects(1)
804           to build "thin" pack, which records objects in deltified form based
805           on objects contained in these excluded commits to reduce network
806           traffic.
807
808       --unpacked
809           Only useful with --objects; print the object IDs that are not in
810           packs.
811
812       --no-walk
813           Only show the given revs, but do not traverse their ancestors.
814
815       --do-walk
816           Overrides a previous --no-walk.
817

PRETTY FORMATS

819       If the commit is a merge, and if the pretty-format is not oneline,
820       email or raw, an additional line is inserted before the Author: line.
821       This line begins with "Merge: " and the sha1s of ancestral commits are
822       printed, separated by spaces. Note that the listed commits may not
823       necessarily be the list of the direct parent commits if you have
824       limited your view of history: for example, if you are only interested
825       in changes related to a certain directory or file.
826
827       Here are some additional details for each format:
828
829       ·    oneline
830
831               <sha1> <title line>
832
833           This is designed to be as compact as possible.
834
835       ·    short
836
837               commit <sha1>
838               Author: <author>
839
840               <title line>
841
842       ·    medium
843
844               commit <sha1>
845               Author: <author>
846               Date:   <author date>
847
848               <title line>
849
850               <full commit message>
851
852       ·    full
853
854               commit <sha1>
855               Author: <author>
856               Commit: <committer>
857
858               <title line>
859
860               <full commit message>
861
862       ·    fuller
863
864               commit <sha1>
865               Author:     <author>
866               AuthorDate: <author date>
867               Commit:     <committer>
868               CommitDate: <committer date>
869
870               <title line>
871
872               <full commit message>
873
874       ·    email
875
876               From <sha1> <date>
877               From: <author>
878               Date: <author date>
879               Subject: [PATCH] <title line>
880
881               <full commit message>
882
883       ·    raw
884
885           The raw format shows the entire commit exactly as stored in the
886           commit object. Notably, the SHA1s are displayed in full, regardless
887           of whether --abbrev or --no-abbrev are used, and parents
888           information show the true parent commits, without taking grafts nor
889           history simplification into account.
890
891       ·    format:
892
893           The format: format allows you to specify which information you want
894           to show. It works a little bit like printf format, with the notable
895           exception that you get a newline with %n instead of \n.
896
897           E.g, format:"The author of %h was %an, %ar%nThe title was >>%s<<%n"
898           would show something like this:
899
900               The author of fe6e0ee was Junio C Hamano, 23 hours ago
901               The title was >>t4119: test autocomputing -p<n> for traditional diff input.<<
902
903           The placeholders are:
904
905           ·    %H: commit hash
906
907           ·    %h: abbreviated commit hash
908
909           ·    %T: tree hash
910
911           ·    %t: abbreviated tree hash
912
913           ·    %P: parent hashes
914
915           ·    %p: abbreviated parent hashes
916
917           ·    %an: author name
918
919           ·    %aN: author name (respecting .mailmap, see git-shortlog(1) or
920               git-blame(1))
921
922           ·    %ae: author email
923
924           ·    %aE: author email (respecting .mailmap, see git-shortlog(1) or
925               git-blame(1))
926
927           ·    %ad: author date (format respects --date= option)
928
929           ·    %aD: author date, RFC2822 style
930
931           ·    %ar: author date, relative
932
933           ·    %at: author date, UNIX timestamp
934
935           ·    %ai: author date, ISO 8601 format
936
937           ·    %cn: committer name
938
939           ·    %cN: committer name (respecting .mailmap, see git-shortlog(1)
940               or git-blame(1))
941
942           ·    %ce: committer email
943
944           ·    %cE: committer email (respecting .mailmap, see git-shortlog(1)
945               or git-blame(1))
946
947           ·    %cd: committer date
948
949           ·    %cD: committer date, RFC2822 style
950
951           ·    %cr: committer date, relative
952
953           ·    %ct: committer date, UNIX timestamp
954
955           ·    %ci: committer date, ISO 8601 format
956
957           ·    %d: ref names, like the --decorate option of git-log(1)
958
959           ·    %e: encoding
960
961           ·    %s: subject
962
963           ·    %f: sanitized subject line, suitable for a filename
964
965           ·    %b: body
966
967           ·    %N: commit notes
968
969           ·    %gD: reflog selector, e.g., refs/stash@{1}
970
971           ·    %gd: shortened reflog selector, e.g., stash@{1}
972
973           ·    %gs: reflog subject
974
975           ·    %Cred: switch color to red
976
977           ·    %Cgreen: switch color to green
978
979           ·    %Cblue: switch color to blue
980
981           ·    %Creset: reset color
982
983           ·    %C(...): color specification, as described in color.branch.*
984               config option
985
986           ·    %m: left, right or boundary mark
987
988           ·    %n: newline
989
990           ·    %%: a raw %
991
992           ·    %x00: print a byte from a hex code
993
994           ·    %w([<w>[,<i1>[,<i2>]]]): switch line wrapping, like the -w
995               option of git-shortlog(1).
996
997           Note
998           Some placeholders may depend on other options given to the revision
999           traversal engine. For example, the %g* reflog options will insert
1000           an empty string unless we are traversing reflog entries (e.g., by
1001           git log -g). The %d placeholder will use the "short" decoration
1002           format if --decorate was not already provided on the command line.
1003
1004       If you add a + (plus sign) after % of a placeholder, a line-feed is
1005       inserted immediately before the expansion if and only if the
1006       placeholder expands to a non-empty string.
1007
1008       If you add a - (minus sign) after % of a placeholder, line-feeds that
1009       immediately precede the expansion are deleted if and only if the
1010       placeholder expands to an empty string.
1011
1012       ·    tformat:
1013
1014           The tformat: format works exactly like format:, except that it
1015           provides "terminator" semantics instead of "separator" semantics.
1016           In other words, each commit has the message terminator character
1017           (usually a newline) appended, rather than a separator placed
1018           between entries. This means that the final entry of a single-line
1019           format will be properly terminated with a new line, just as the
1020           "oneline" format does. For example:
1021
1022               $ git log -2 --pretty=format:%h 4da45bef \
1023                 | perl -pe ´$_ .= " -- NO NEWLINE\n" unless /\n/´
1024               4da45be
1025               7134973 -- NO NEWLINE
1026
1027               $ git log -2 --pretty=tformat:%h 4da45bef \
1028                 | perl -pe ´$_ .= " -- NO NEWLINE\n" unless /\n/´
1029               4da45be
1030               7134973
1031
1032           In addition, any unrecognized string that has a % in it is
1033           interpreted as if it has tformat: in front of it. For example,
1034           these two are equivalent:
1035
1036               $ git log -2 --pretty=tformat:%h 4da45bef
1037               $ git log -2 --pretty=%h 4da45bef
1038
1039

GENERATING PATCHES WITH -P

1041       When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
1042       with a -p option, "git diff" without the --raw option, or "git log"
1043       with the "-p" option, they do not produce the output described above;
1044       instead they produce a patch file. You can customize the creation of
1045       such patches via the GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS
1046       environment variables.
1047
1048       What the -p option produces is slightly different from the traditional
1049       diff format.
1050
1051        1. It is preceded with a "git diff" header, that looks like this:
1052
1053               diff --git a/file1 b/file2
1054
1055           The a/ and b/ filenames are the same unless rename/copy is
1056           involved. Especially, even for a creation or a deletion, /dev/null
1057           is not used in place of a/ or b/ filenames.
1058
1059           When rename/copy is involved, file1 and file2 show the name of the
1060           source file of the rename/copy and the name of the file that
1061           rename/copy produces, respectively.
1062
1063        2. It is followed by one or more extended header lines:
1064
1065               old mode <mode>
1066               new mode <mode>
1067               deleted file mode <mode>
1068               new file mode <mode>
1069               copy from <path>
1070               copy to <path>
1071               rename from <path>
1072               rename to <path>
1073               similarity index <number>
1074               dissimilarity index <number>
1075               index <hash>..<hash> <mode>
1076
1077        3. TAB, LF, double quote and backslash characters in pathnames are
1078           represented as \t, \n, \" and \\, respectively. If there is need
1079           for such substitution then the whole pathname is put in double
1080           quotes.
1081
1082       The similarity index is the percentage of unchanged lines, and the
1083       dissimilarity index is the percentage of changed lines. It is a rounded
1084       down integer, followed by a percent sign. The similarity index value of
1085       100% is thus reserved for two equal files, while 100% dissimilarity
1086       means that no line from the old file made it into the new one.
1087

COMBINED DIFF FORMAT

1089       "git-diff-tree", "git-diff-files" and "git-diff" can take -c or --cc
1090       option to produce combined diff. For showing a merge commit with "git
1091       log -p", this is the default format; you can force showing full diff
1092       with the -m option. A combined diff format looks like this:
1093
1094           diff --combined describe.c
1095           index fabadb8,cc95eb0..4866510
1096           --- a/describe.c
1097           +++ b/describe.c
1098           @@@ -98,20 -98,12 +98,20 @@@
1099                   return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
1100             }
1101
1102           - static void describe(char *arg)
1103            -static void describe(struct commit *cmit, int last_one)
1104           ++static void describe(char *arg, int last_one)
1105             {
1106            +      unsigned char sha1[20];
1107            +      struct commit *cmit;
1108                   struct commit_list *list;
1109                   static int initialized = 0;
1110                   struct commit_name *n;
1111
1112            +      if (get_sha1(arg, sha1) < 0)
1113            +              usage(describe_usage);
1114            +      cmit = lookup_commit_reference(sha1);
1115            +      if (!cmit)
1116            +              usage(describe_usage);
1117            +
1118                   if (!initialized) {
1119                           initialized = 1;
1120                           for_each_ref(get_name);
1121
1122
1123
1124        1. It is preceded with a "git diff" header, that looks like this (when
1125           -c option is used):
1126
1127               diff --combined file
1128
1129           or like this (when --cc option is used):
1130
1131               diff --cc file
1132
1133        2. It is followed by one or more extended header lines (this example
1134           shows a merge with two parents):
1135
1136               index <hash>,<hash>..<hash>
1137               mode <mode>,<mode>..<mode>
1138               new file mode <mode>
1139               deleted file mode <mode>,<mode>
1140
1141           The mode <mode>,<mode>..<mode> line appears only if at least one of
1142           the <mode> is different from the rest. Extended headers with
1143           information about detected contents movement (renames and copying
1144           detection) are designed to work with diff of two <tree-ish> and are
1145           not used by combined diff format.
1146
1147        3. It is followed by two-line from-file/to-file header
1148
1149               --- a/file
1150               +++ b/file
1151
1152           Similar to two-line header for traditional unified diff format,
1153           /dev/null is used to signal created or deleted files.
1154
1155        4. Chunk header format is modified to prevent people from accidentally
1156           feeding it to patch -p1. Combined diff format was created for
1157           review of merge commit changes, and was not meant for apply. The
1158           change is similar to the change in the extended index header:
1159
1160               @@@ <from-file-range> <from-file-range> <to-file-range> @@@
1161
1162           There are (number of parents + 1) @ characters in the chunk header
1163           for combined diff format.
1164
1165       Unlike the traditional unified diff format, which shows two files A and
1166       B with a single column that has - (minus — appears in A but removed in
1167       B), + (plus — missing in A but added to B), or " " (space — unchanged)
1168       prefix, this format compares two or more files file1, file2,... with
1169       one file X, and shows how X differs from each of fileN. One column for
1170       each of fileN is prepended to the output line to note how X’s line is
1171       different from it.
1172
1173       A - character in the column N means that the line appears in fileN but
1174       it does not appear in the result. A + character in the column N means
1175       that the line appears in the result, and fileN does not have that line
1176       (in other words, the line was added, from the point of view of that
1177       parent).
1178
1179       In the above example output, the function signature was changed from
1180       both files (hence two - removals from both file1 and file2, plus ++ to
1181       mean one line that was added does not appear in either file1 nor
1182       file2). Also eight other lines are the same from file1 but do not
1183       appear in file2 (hence prefixed with +).
1184
1185       When shown by git diff-tree -c, it compares the parents of a merge
1186       commit with the merge result (i.e. file1..fileN are the parents). When
1187       shown by git diff-files -c, it compares the two unresolved merge
1188       parents with the working tree file (i.e. file1 is stage 2 aka "our
1189       version", file2 is stage 3 aka "their version").
1190

EXAMPLES

1192       git log --no-merges
1193           Show the whole commit history, but skip any merges
1194
1195       git log v2.6.12.. include/scsi drivers/scsi
1196           Show all commits since version v2.6.12 that changed any file in the
1197           include/scsi or drivers/scsi subdirectories
1198
1199       git log --since="2 weeks ago" -- gitk
1200           Show the changes during the last two weeks to the file gitk. The
1201           "--" is necessary to avoid confusion with the branch named gitk
1202
1203       git log --name-status release..test
1204           Show the commits that are in the "test" branch but not yet in the
1205           "release" branch, along with the list of paths each commit
1206           modifies.
1207
1208       git log --follow builtin-rev-list.c
1209           Shows the commits that changed builtin-rev-list.c, including those
1210           commits that occurred before the file was given its present name.
1211
1212       git log --branches --not --remotes=origin
1213           Shows all commits that are in any of local branches but not in any
1214           of remote tracking branches for origin (what you have that origin
1215           doesn’t).
1216
1217       git log master --not --remotes=*/master
1218           Shows all commits that are in local master but not in any remote
1219           repository master branches.
1220
1221       git log -p -m --first-parent
1222           Shows the history including change diffs, but only from the "main
1223           branch" perspective, skipping commits that come from merged
1224           branches, and showing full diffs of changes introduced by the
1225           merges. This makes sense only when following a strict policy of
1226           merging all topic branches when staying on a single integration
1227           branch.
1228

DISCUSSION

1230       At the core level, git is character encoding agnostic.
1231
1232       ·   The pathnames recorded in the index and in the tree objects are
1233           treated as uninterpreted sequences of non-NUL bytes. What
1234           readdir(2) returns are what are recorded and compared with the data
1235           git keeps track of, which in turn are expected to be what lstat(2)
1236           and creat(2) accepts. There is no such thing as pathname encoding
1237           translation.
1238
1239       ·   The contents of the blob objects are uninterpreted sequences of
1240           bytes. There is no encoding translation at the core level.
1241
1242       ·   The commit log messages are uninterpreted sequences of non-NUL
1243           bytes.
1244
1245       Although we encourage that the commit log messages are encoded in
1246       UTF-8, both the core and git Porcelain are designed not to force UTF-8
1247       on projects. If all participants of a particular project find it more
1248       convenient to use legacy encodings, git does not forbid it. However,
1249       there are a few things to keep in mind.
1250
1251        1.  git commit and git commit-tree issues a warning if the commit log
1252           message given to it does not look like a valid UTF-8 string, unless
1253           you explicitly say your project uses a legacy encoding. The way to
1254           say this is to have i18n.commitencoding in .git/config file, like
1255           this:
1256
1257               [i18n]
1258                       commitencoding = ISO-8859-1
1259
1260           Commit objects created with the above setting record the value of
1261           i18n.commitencoding in its encoding header. This is to help other
1262           people who look at them later. Lack of this header implies that the
1263           commit log message is encoded in UTF-8.
1264
1265        2.  git log, git show, git blame and friends look at the encoding
1266           header of a commit object, and try to re-code the log message into
1267           UTF-8 unless otherwise specified. You can specify the desired
1268           output encoding with i18n.logoutputencoding in .git/config file,
1269           like this:
1270
1271               [i18n]
1272                       logoutputencoding = ISO-8859-1
1273
1274           If you do not have this configuration variable, the value of
1275           i18n.commitencoding is used instead.
1276
1277       Note that we deliberately chose not to re-code the commit log message
1278       when a commit is made to force UTF-8 at the commit object level,
1279       because re-coding to UTF-8 is not necessarily a reversible operation.
1280

AUTHOR

1282       Written by Linus Torvalds <torvalds@osdl.org[1]>
1283

DOCUMENTATION

1285       Documentation by David Greaves, Junio C Hamano and the git-list
1286       <git@vger.kernel.org[2]>.
1287

GIT

1289       Part of the git(1) suite
1290

NOTES

1292        1. torvalds@osdl.org
1293           mailto:torvalds@osdl.org
1294
1295        2. git@vger.kernel.org
1296           mailto:git@vger.kernel.org
1297
1298
1299
1300Git 1.7.1                         08/16/2017                        GIT-LOG(1)
Impressum