blob: 32246fdb007e9b25f414cff092b9bf0426c55d15 [file] [log] [blame]
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001git-log(1)
2==========
Junio C Hamano3f971fc2005-08-14 17:24:36 -07003
4NAME
5----
Junio C Hamano215a7ad2005-09-07 17:26:23 -07006git-log - Show commit logs
Junio C Hamano3f971fc2005-08-14 17:24:36 -07007
8
9SYNOPSIS
10--------
Martin von Zweigbergk7791a1d2011-07-01 22:38:26 -040011[verse]
Ramkumar Ramachandra21a40b92013-04-22 11:00:28 +053012'git log' [<options>] [<revision range>] [[\--] <path>...]
Junio C Hamano3f971fc2005-08-14 17:24:36 -070013
14DESCRIPTION
15-----------
Junio C Hamanoe51c3b52006-04-14 12:59:09 -070016Shows the commit logs.
Junio C Hamano3f971fc2005-08-14 17:24:36 -070017
Jason St. Johnb20cc132013-11-13 01:21:49 -050018The command takes options applicable to the `git rev-list`
Junio C Hamanoe51c3b52006-04-14 12:59:09 -070019command to control what is shown and how, and options applicable to
Jason St. Johnb20cc132013-11-13 01:21:49 -050020the `git diff-*` commands to control how the changes
Junio C Hamanoe51c3b52006-04-14 12:59:09 -070021each commit introduces are shown.
22
Junio C Hamano3f971fc2005-08-14 17:24:36 -070023
24OPTIONS
25-------
Chris Riddoch5d1faf82006-11-21 16:49:15 -070026
Eli Barzilay4ded6912010-07-07 22:14:31 -040027--follow::
28 Continue listing the history of a file beyond renames
29 (works only for a single file).
30
Junio C Hamano8a3d2032010-02-17 10:20:49 -080031--no-decorate::
Ramsay Jones462cbb42016-05-27 16:56:02 +010032--decorate[=short|full|auto|no]::
Lars Hjemli33e70182009-08-15 16:23:12 +020033 Print out the ref names of any commits that are shown. If 'short' is
34 specified, the ref name prefixes 'refs/heads/', 'refs/tags/' and
35 'refs/remotes/' will not be printed. If 'full' is specified, the
Ramsay Jones462cbb42016-05-27 16:56:02 +010036 full ref name (including prefix) will be printed. If 'auto' is
37 specified, then if the output is going to a terminal, the ref names
38 are shown as if 'short' were given, otherwise no ref names are
39 shown. The default option is 'short'.
Michael Hendricks56822cc2007-05-10 16:09:38 -060040
Nanako Shiraishi30c4d7a2008-11-10 18:58:15 +090041--source::
42 Print out the ref name given on the command line by which each
43 commit was reached.
44
Antoine Pelisseea57bc02013-01-05 22:26:43 +010045--use-mailmap::
46 Use mailmap file to map author and committer names and email
Jason St. Johnb20cc132013-11-13 01:21:49 -050047 addresses to canonical real names and email addresses. See
Antoine Pelisseea57bc02013-01-05 22:26:43 +010048 linkgit:git-shortlog[1].
49
Jakub Narebski2e88c262007-06-16 21:03:38 +020050--full-diff::
Jason St. Johnb20cc132013-11-13 01:21:49 -050051 Without this flag, `git log -p <path>...` shows commits that
Jakub Narebski2e88c262007-06-16 21:03:38 +020052 touch the specified paths, and diffs about the same specified
53 paths. With this, the full diff is shown for commits that touch
Abhijit Menon-Senf448e242008-07-30 15:03:43 +053054 the specified paths; this means that "<path>..." limits only
Jakub Narebski2e88c262007-06-16 21:03:38 +020055 commits, and doesn't limit diff for those commits.
Michael J Gruberb1c79462010-08-08 17:31:34 +020056+
57Note that this affects all diff-based output types, e.g. those
Jason St. Johnb20cc132013-11-13 01:21:49 -050058produced by `--stat`, etc.
Jakub Narebski2e88c262007-06-16 21:03:38 +020059
Marco Costalba9fa34652007-07-20 20:15:13 +020060--log-size::
Jason St. Johnc20e6fb2013-11-13 01:21:48 -050061 Include a line ``log size <number>'' in the output for each commit,
62 where <number> is the length of that commit's message in bytes.
63 Intended to speed up tools that read log messages from `git log`
64 output by allowing them to allocate space in advance.
Marco Costalba9fa34652007-07-20 20:15:13 +020065
Eric Sunshine1e159832013-08-06 09:59:34 -040066-L <start>,<end>:<file>::
Matthieu Moyd349e0e2015-04-20 14:09:06 +020067-L :<funcname>:<file>::
Thomas Rast12da1d12013-03-28 17:47:32 +010068 Trace the evolution of the line range given by "<start>,<end>"
Matthieu Moyd349e0e2015-04-20 14:09:06 +020069 (or the function name regex <funcname>) within the <file>. You may
Thomas Rast13b8f682013-03-28 17:47:33 +010070 not give any pathspec limiters. This is currently limited to
71 a walk starting from a single revision, i.e., you may only
72 give zero or one positive revision arguments.
Junio C Hamano0f483432013-04-21 19:40:49 -070073 You can specify this option more than once.
74+
Thomas Rast12da1d12013-03-28 17:47:32 +010075include::line-range-format.txt[]
Thomas Rast12da1d12013-03-28 17:47:32 +010076
Ramkumar Ramachandra21a40b92013-04-22 11:00:28 +053077<revision range>::
78 Show only commits in the specified revision range. When no
79 <revision range> is specified, it defaults to `HEAD` (i.e. the
80 whole history leading to the current commit). `origin..HEAD`
81 specifies all the commits reachable from the current commit
82 (i.e. `HEAD`), but not from `origin`. For a complete list of
Jason St. Johnb20cc132013-11-13 01:21:49 -050083 ways to spell <revision range>, see the 'Specifying Ranges'
Ramkumar Ramachandra21a40b92013-04-22 11:00:28 +053084 section of linkgit:gitrevisions[7].
Ramkumar Ramachandraa6821872013-04-22 11:00:27 +053085
martin f. krafftb1524ee2008-09-30 21:57:50 +020086[\--] <path>...::
Thomas Rastb15b5b12011-08-30 11:21:07 +020087 Show only commits that are enough to explain how the files
Jason St. Johnb20cc132013-11-13 01:21:49 -050088 that match the specified paths came to be. See 'History
89 Simplification' below for details and other simplification
Thomas Rastb15b5b12011-08-30 11:21:07 +020090 modes.
91+
Jason St. Johnb20cc132013-11-13 01:21:49 -050092Paths may need to be prefixed with ``\-- '' to separate them from
Ramkumar Ramachandra00200e92013-04-22 11:00:29 +053093options or the revision range, when confusion arises.
Junio C Hamanoe51c3b52006-04-14 12:59:09 -070094
Miklos Vajnafdcf39e2008-01-18 23:58:57 +010095include::rev-list-options.txt[]
96
Jakub Narebski331b51d2007-05-14 01:25:45 +020097include::pretty-formats.txt[]
98
Matthieu Moy4ba258b2013-07-16 10:05:40 +020099COMMON DIFF OPTIONS
Michael J Gruberf98fd432011-03-08 09:31:26 +0100100-------------------
101
102:git-log: 1
103include::diff-options.txt[]
104
Miklos Vajna272bd3c2007-11-01 15:57:40 +0100105include::diff-generate-patch.txt[]
Jakub Narebski331b51d2007-05-14 01:25:45 +0200106
Matthieu Moy4ba258b2013-07-16 10:05:40 +0200107EXAMPLES
Linus Torvaldsbd663612005-10-30 20:05:32 -0800108--------
Jeff King5d2fc912011-08-03 20:13:29 -0600109`git log --no-merges`::
Linus Torvaldsbd663612005-10-30 20:05:32 -0800110
111 Show the whole commit history, but skip any merges
112
Jeff King5d2fc912011-08-03 20:13:29 -0600113`git log v2.6.12.. include/scsi drivers/scsi`::
Linus Torvaldsbd663612005-10-30 20:05:32 -0800114
115 Show all commits since version 'v2.6.12' that changed any file
Jason St. Johnb20cc132013-11-13 01:21:49 -0500116 in the `include/scsi` or `drivers/scsi` subdirectories
Linus Torvaldsbd663612005-10-30 20:05:32 -0800117
Jeff King6cf378f2012-04-26 04:51:57 -0400118`git log --since="2 weeks ago" -- gitk`::
Linus Torvaldsbd663612005-10-30 20:05:32 -0800119
120 Show the changes during the last two weeks to the file 'gitk'.
Jason St. Johnb20cc132013-11-13 01:21:49 -0500121 The ``--'' is necessary to avoid confusion with the *branch* named
Linus Torvaldsbd663612005-10-30 20:05:32 -0800122 'gitk'
123
Jeff King5d2fc912011-08-03 20:13:29 -0600124`git log --name-status release..test`::
Junio C Hamanoe51c3b52006-04-14 12:59:09 -0700125
126 Show the commits that are in the "test" branch but not yet
127 in the "release" branch, along with the list of paths
128 each commit modifies.
Linus Torvaldsbd663612005-10-30 20:05:32 -0800129
Phil Hord09b7e222013-06-18 13:44:58 -0400130`git log --follow builtin/rev-list.c`::
Steven Walter4f50f6a2007-07-12 10:52:30 -0400131
Jason St. Johnb20cc132013-11-13 01:21:49 -0500132 Shows the commits that changed `builtin/rev-list.c`, including
Steven Walter4f50f6a2007-07-12 10:52:30 -0400133 those commits that occurred before the file was given its
134 present name.
135
Jeff King5d2fc912011-08-03 20:13:29 -0600136`git log --branches --not --remotes=origin`::
Ilari Liusvaarad08bae72010-01-20 11:48:25 +0200137
138 Shows all commits that are in any of local branches but not in
Matthieu Moy0e615b22010-11-02 16:31:20 +0100139 any of remote-tracking branches for 'origin' (what you have that
Ilari Liusvaarad08bae72010-01-20 11:48:25 +0200140 origin doesn't).
141
Jeff King5d2fc912011-08-03 20:13:29 -0600142`git log master --not --remotes=*/master`::
Ilari Liusvaarad08bae72010-01-20 11:48:25 +0200143
144 Shows all commits that are in local master but not in any remote
145 repository master branches.
146
Jeff King5d2fc912011-08-03 20:13:29 -0600147`git log -p -m --first-parent`::
Petr Baudis88d9d452010-02-10 02:11:49 +0100148
149 Shows the history including change diffs, but only from the
Jason St. Johnb20cc132013-11-13 01:21:49 -0500150 ``main branch'' perspective, skipping commits that come from merged
Petr Baudis88d9d452010-02-10 02:11:49 +0100151 branches, and showing full diffs of changes introduced by the merges.
152 This makes sense only when following a strict policy of merging all
153 topic branches when staying on a single integration branch.
154
Eric Sunshine001b0972013-07-15 20:10:36 -0400155`git log -L '/int main/',/^}/:main.c`::
Thomas Rast12da1d12013-03-28 17:47:32 +0100156
Jason St. Johnb20cc132013-11-13 01:21:49 -0500157 Shows how the function `main()` in the file `main.c` evolved
Thomas Rast12da1d12013-03-28 17:47:32 +0100158 over time.
159
Nguyễn Thái Ngọc Duy70c2a252012-09-06 21:28:03 +0700160`git log -3`::
Jason St. Johnb20cc132013-11-13 01:21:49 -0500161
Nguyễn Thái Ngọc Duy70c2a252012-09-06 21:28:03 +0700162 Limits the number of commits to show to 3.
Petr Baudis88d9d452010-02-10 02:11:49 +0100163
Matthieu Moy4ba258b2013-07-16 10:05:40 +0200164DISCUSSION
Junio C Hamano5dc7bcc2006-12-30 02:22:38 -0800165----------
166
167include::i18n.txt[]
168
Matthieu Moy4ba258b2013-07-16 10:05:40 +0200169CONFIGURATION
Jonathan Nieder59893a82010-05-08 22:30:41 -0500170-------------
171
172See linkgit:git-config[1] for core variables and linkgit:git-diff[1]
173for settings related to diff generation.
174
175format.pretty::
Jason St. Johnb20cc132013-11-13 01:21:49 -0500176 Default for the `--format` option. (See 'Pretty Formats' above.)
177 Defaults to `medium`.
Jonathan Nieder59893a82010-05-08 22:30:41 -0500178
179i18n.logOutputEncoding::
Jason St. Johnb20cc132013-11-13 01:21:49 -0500180 Encoding to use when displaying logs. (See 'Discussion' above.)
181 Defaults to the value of `i18n.commitEncoding` if set, and UTF-8
Jonathan Nieder59893a82010-05-08 22:30:41 -0500182 otherwise.
183
184log.date::
185 Default format for human-readable dates. (Compare the
186 `--date` option.) Defaults to "default", which means to write
187 dates like `Sat May 8 19:35:34 2010 -0500`.
188
David Turner076c9832015-07-07 21:29:34 -0400189log.follow::
Eric N. Vander Weelefd8d07e2015-10-06 21:14:33 -0400190 If `true`, `git log` will act as if the `--follow` option was used when
191 a single <path> is given. This has the same limitations as `--follow`,
192 i.e. it cannot be used to follow multiple files and does not work well
193 on non-linear history.
David Turner076c9832015-07-07 21:29:34 -0400194
Nguyễn Thái Ngọc Duyda0005b2015-03-11 16:32:45 -0400195log.showRoot::
Jason St. Johnb20cc132013-11-13 01:21:49 -0500196 If `false`, `git log` and related commands will not treat the
Jonathan Nieder59893a82010-05-08 22:30:41 -0500197 initial commit as a big creation event. Any root commits in
198 `git log -p` output would be shown without a diff attached.
199 The default is `true`.
200
Mehul Jainfce04c32016-06-22 22:21:26 +0530201log.showSignature::
202 If `true`, `git log` and related commands will act as if the
203 `--show-signature` option was passed to them.
204
Jeff Kingd5422b02012-12-13 08:08:12 -0500205mailmap.*::
Jonathan Nieder59893a82010-05-08 22:30:41 -0500206 See linkgit:git-shortlog[1].
207
208notes.displayRef::
209 Which refs, in addition to the default set by `core.notesRef`
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200210 or `GIT_NOTES_REF`, to read notes from when showing commit
Jason St. Johnb20cc132013-11-13 01:21:49 -0500211 messages with the `log` family of commands. See
Jonathan Nieder59893a82010-05-08 22:30:41 -0500212 linkgit:git-notes[1].
213+
214May be an unabbreviated ref name or a glob and may be specified
215multiple times. A warning will be issued for refs that do not exist,
216but a glob that does not match any refs is silently ignored.
217+
Johan Herlandab18b2c2011-03-30 02:57:19 +0200218This setting can be disabled by the `--no-notes` option,
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200219overridden by the `GIT_NOTES_DISPLAY_REF` environment variable,
Johan Herlandab18b2c2011-03-30 02:57:19 +0200220and overridden by the `--notes=<ref>` option.
Junio C Hamano5dc7bcc2006-12-30 02:22:38 -0800221
Junio C Hamano3f971fc2005-08-14 17:24:36 -0700222GIT
223---
Christian Couder9e1f0a82008-06-06 09:07:32 +0200224Part of the linkgit:git[1] suite