blob: 5692945a0b38c0b9e8e79e73a9a755c292224c98 [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231git-log(1)
2==========
3
4NAME
5----
6git-log - Show commit logs
7
8
9SYNOPSIS
10--------
Junio C Hamano15567bc2011-07-23 00:51:5911[verse]
Junio C Hamanof26c77e2013-04-27 00:06:0412'git log' [<options>] [<revision range>] [[\--] <path>...]
Junio C Hamano1a4e8412005-12-27 08:17:2313
14DESCRIPTION
15-----------
Junio C Hamanoba7c8d82006-04-15 06:17:4216Shows the commit logs.
Junio C Hamano1a4e8412005-12-27 08:17:2317
Junio C Hamanob73af6c2013-12-03 22:07:1118The command takes options applicable to the `git rev-list`
Junio C Hamanoba7c8d82006-04-15 06:17:4219command to control what is shown and how, and options applicable to
Junio C Hamanob73af6c2013-12-03 22:07:1120the `git diff-*` commands to control how the changes
Junio C Hamanoba7c8d82006-04-15 06:17:4221each commit introduces are shown.
22
Junio C Hamano1a4e8412005-12-27 08:17:2323
24OPTIONS
25-------
Junio C Hamanoa340aaa2006-11-23 02:47:3326
Junio C Hamano78e3a782010-07-15 22:24:4527--follow::
28Continue listing the history of a file beyond renames
29(works only for a single file).
Junio C Hamano1a4e8412005-12-27 08:17:2330
Junio C Hamanocb39aea2010-05-09 07:24:4831--no-decorate::
32--decorate[=short|full|no]::
Junio C Hamanoc276ec72009-08-26 01:35:2233Print out the ref names of any commits that are shown. If 'short' is
34specified, the ref name prefixes 'refs/heads/', 'refs/tags/' and
35'refs/remotes/' will not be printed. If 'full' is specified, the
36full ref name (including prefix) will be printed. The default option
37is 'short'.
Junio C Hamanoee695f22007-06-21 00:35:3638
Junio C Hamano28363492008-11-14 08:26:3139--source::
40Print out the ref name given on the command line by which each
41commit was reached.
42
Junio C Hamanoce836cc2013-01-21 02:01:5343--use-mailmap::
44Use mailmap file to map author and committer names and email
Junio C Hamanob73af6c2013-12-03 22:07:1145addresses to canonical real names and email addresses. See
Junio C Hamanoce836cc2013-01-21 02:01:5346linkgit:git-shortlog[1].
47
Junio C Hamanoee695f22007-06-21 00:35:3648--full-diff::
Junio C Hamanob73af6c2013-12-03 22:07:1149Without this flag, `git log -p <path>...` shows commits that
Junio C Hamanoee695f22007-06-21 00:35:3650touch the specified paths, and diffs about the same specified
51paths. With this, the full diff is shown for commits that touch
Junio C Hamano9e395072008-07-31 22:11:2152the specified paths; this means that "<path>..." limits only
Junio C Hamanoee695f22007-06-21 00:35:3653commits, and doesn't limit diff for those commits.
Junio C Hamanoe85e36f2010-08-10 05:30:1454+
55Note that this affects all diff-based output types, e.g. those
Junio C Hamanob73af6c2013-12-03 22:07:1156produced by `--stat`, etc.
Junio C Hamanoea5dae62007-05-10 23:25:0857
Junio C Hamano024b6c62007-08-14 09:43:0858--log-size::
Junio C Hamanob73af6c2013-12-03 22:07:1159Include a line ``log size <number>'' in the output for each commit,
60where <number> is the length of that commit's message in bytes.
61Intended to speed up tools that read log messages from `git log`
62output by allowing them to allocate space in advance.
Junio C Hamano024b6c62007-08-14 09:43:0863
Junio C Hamano8eac2682013-09-09 22:35:2064-L <start>,<end>:<file>::
Junio C Hamanodd5004a2015-05-06 19:33:3265-L :<funcname>:<file>::
Junio C Hamano7e590a12013-06-02 23:46:5266Trace the evolution of the line range given by "<start>,<end>"
Junio C Hamanodd5004a2015-05-06 19:33:3267(or the function name regex <funcname>) within the <file>. You may
Junio C Hamano7e590a12013-06-02 23:46:5268not give any pathspec limiters. This is currently limited to
69a walk starting from a single revision, i.e., you may only
70give zero or one positive revision arguments.
71You can specify this option more than once.
72+
Junio C Hamano7e590a12013-06-02 23:46:5273include::line-range-format.txt[]
74
Junio C Hamanof26c77e2013-04-27 00:06:0475<revision range>::
76Show only commits in the specified revision range. When no
77<revision range> is specified, it defaults to `HEAD` (i.e. the
78whole history leading to the current commit). `origin..HEAD`
79specifies all the commits reachable from the current commit
80(i.e. `HEAD`), but not from `origin`. For a complete list of
Junio C Hamanob73af6c2013-12-03 22:07:1181ways to spell <revision range>, see the 'Specifying Ranges'
Junio C Hamanof26c77e2013-04-27 00:06:0482section of linkgit:gitrevisions[7].
83
Junio C Hamanoa476efa2008-10-10 15:31:4284[\--] <path>...::
Junio C Hamano5723afa2011-08-31 00:49:2385Show only commits that are enough to explain how the files
Junio C Hamanob73af6c2013-12-03 22:07:1186that match the specified paths came to be. See 'History
87Simplification' below for details and other simplification
Junio C Hamano5723afa2011-08-31 00:49:2388modes.
89+
Junio C Hamanob73af6c2013-12-03 22:07:1190Paths may need to be prefixed with ``\-- '' to separate them from
Junio C Hamanof26c77e2013-04-27 00:06:0491options or the revision range, when confusion arises.
Junio C Hamanoba7c8d82006-04-15 06:17:4292
Junio C Hamanob0e02952008-01-19 08:02:0093include::rev-list-options.txt[]
94
Junio C Hamano0430e3a2007-05-15 03:13:1795include::pretty-formats.txt[]
96
Junio C Hamano58f587a2013-07-22 19:20:5997COMMON DIFF OPTIONS
Junio C Hamanod2c978f2011-03-20 19:42:2298-------------------
99
100:git-log: 1
101include::diff-options.txt[]
102
Junio C Hamano00b8b632007-12-07 09:50:49103include::diff-generate-patch.txt[]
Junio C Hamano0430e3a2007-05-15 03:13:17104
Junio C Hamano58f587a2013-07-22 19:20:59105EXAMPLES
Junio C Hamano1a4e8412005-12-27 08:17:23106--------
Junio C Hamano16ebcd02011-08-05 00:05:45107`git log --no-merges`::
Junio C Hamano1a4e8412005-12-27 08:17:23108
109Show the whole commit history, but skip any merges
110
Junio C Hamano16ebcd02011-08-05 00:05:45111`git log v2.6.12.. include/scsi drivers/scsi`::
Junio C Hamano1a4e8412005-12-27 08:17:23112
113Show all commits since version 'v2.6.12' that changed any file
Junio C Hamanob73af6c2013-12-03 22:07:11114in the `include/scsi` or `drivers/scsi` subdirectories
Junio C Hamano1a4e8412005-12-27 08:17:23115
Junio C Hamanob76a6862012-05-02 22:02:46116`git log --since="2 weeks ago" -- gitk`::
Junio C Hamano1a4e8412005-12-27 08:17:23117
118Show the changes during the last two weeks to the file 'gitk'.
Junio C Hamanob73af6c2013-12-03 22:07:11119The ``--'' is necessary to avoid confusion with the *branch* named
Junio C Hamano1a4e8412005-12-27 08:17:23120'gitk'
121
Junio C Hamano16ebcd02011-08-05 00:05:45122`git log --name-status release..test`::
Junio C Hamanoba7c8d82006-04-15 06:17:42123
124Show the commits that are in the "test" branch but not yet
125in the "release" branch, along with the list of paths
126each commit modifies.
Junio C Hamano1a4e8412005-12-27 08:17:23127
Junio C Hamano3a3357e2013-06-26 23:20:56128`git log --follow builtin/rev-list.c`::
Junio C Hamano235d53f2007-07-13 00:25:15129
Junio C Hamanob73af6c2013-12-03 22:07:11130Shows the commits that changed `builtin/rev-list.c`, including
Junio C Hamano235d53f2007-07-13 00:25:15131those commits that occurred before the file was given its
132present name.
133
Junio C Hamano16ebcd02011-08-05 00:05:45134`git log --branches --not --remotes=origin`::
Junio C Hamano57827fb2010-01-23 03:02:50135
136Shows all commits that are in any of local branches but not in
Junio C Hamano97bcb482010-11-25 03:16:07137any of remote-tracking branches for 'origin' (what you have that
Junio C Hamano57827fb2010-01-23 03:02:50138origin doesn't).
139
Junio C Hamano16ebcd02011-08-05 00:05:45140`git log master --not --remotes=*/master`::
Junio C Hamano57827fb2010-01-23 03:02:50141
142Shows all commits that are in local master but not in any remote
143repository master branches.
144
Junio C Hamano16ebcd02011-08-05 00:05:45145`git log -p -m --first-parent`::
Junio C Hamano31667362010-03-25 00:38:53146
147Shows the history including change diffs, but only from the
Junio C Hamanob73af6c2013-12-03 22:07:11148``main branch'' perspective, skipping commits that come from merged
Junio C Hamano31667362010-03-25 00:38:53149branches, and showing full diffs of changes introduced by the merges.
150This makes sense only when following a strict policy of merging all
151topic branches when staying on a single integration branch.
152
Junio C Hamano24b68352013-07-18 02:15:20153`git log -L '/int main/',/^}/:main.c`::
Junio C Hamano7e590a12013-06-02 23:46:52154
Junio C Hamanob73af6c2013-12-03 22:07:11155Shows how the function `main()` in the file `main.c` evolved
Junio C Hamano7e590a12013-06-02 23:46:52156over time.
157
Junio C Hamano693e7092012-09-12 22:56:53158`git log -3`::
Junio C Hamanob73af6c2013-12-03 22:07:11159
Junio C Hamano693e7092012-09-12 22:56:53160Limits the number of commits to show to 3.
Junio C Hamano31667362010-03-25 00:38:53161
Junio C Hamano58f587a2013-07-22 19:20:59162DISCUSSION
Junio C Hamano775a0f42006-12-31 01:19:14163----------
164
165include::i18n.txt[]
166
Junio C Hamano58f587a2013-07-22 19:20:59167CONFIGURATION
Junio C Hamanoa574a092010-06-13 19:57:10168-------------
169
170See linkgit:git-config[1] for core variables and linkgit:git-diff[1]
171for settings related to diff generation.
172
173format.pretty::
Junio C Hamanob73af6c2013-12-03 22:07:11174Default for the `--format` option. (See 'Pretty Formats' above.)
175Defaults to `medium`.
Junio C Hamanoa574a092010-06-13 19:57:10176
177i18n.logOutputEncoding::
Junio C Hamanob73af6c2013-12-03 22:07:11178Encoding to use when displaying logs. (See 'Discussion' above.)
179Defaults to the value of `i18n.commitEncoding` if set, and UTF-8
Junio C Hamanoa574a092010-06-13 19:57:10180otherwise.
181
182log.date::
183Default format for human-readable dates. (Compare the
184`--date` option.) Defaults to "default", which means to write
185dates like `Sat May 8 19:35:34 2010 -0500`.
186
Junio C Hamano322c6242015-03-23 21:32:46187log.showRoot::
Junio C Hamanob73af6c2013-12-03 22:07:11188If `false`, `git log` and related commands will not treat the
Junio C Hamanoa574a092010-06-13 19:57:10189initial commit as a big creation event. Any root commits in
190`git log -p` output would be shown without a diff attached.
191The default is `true`.
192
Junio C Hamanoabad6da2013-01-06 09:06:32193mailmap.*::
Junio C Hamanoa574a092010-06-13 19:57:10194See linkgit:git-shortlog[1].
195
196notes.displayRef::
197Which refs, in addition to the default set by `core.notesRef`
198or 'GIT_NOTES_REF', to read notes from when showing commit
Junio C Hamanob73af6c2013-12-03 22:07:11199messages with the `log` family of commands. See
Junio C Hamanoa574a092010-06-13 19:57:10200linkgit:git-notes[1].
201+
202May be an unabbreviated ref name or a glob and may be specified
203multiple times. A warning will be issued for refs that do not exist,
204but a glob that does not match any refs is silently ignored.
205+
Junio C Hamano60033462011-05-03 00:48:43206This setting can be disabled by the `--no-notes` option,
Junio C Hamanoa574a092010-06-13 19:57:10207overridden by the 'GIT_NOTES_DISPLAY_REF' environment variable,
Junio C Hamano60033462011-05-03 00:48:43208and overridden by the `--notes=<ref>` option.
Junio C Hamano775a0f42006-12-31 01:19:14209
Junio C Hamano1a4e8412005-12-27 08:17:23210GIT
211---
Junio C Hamanof7c042d2008-06-06 22:50:53212Part of the linkgit:git[1] suite