Junio C Hamano | 215a7ad | 2005-09-07 17:26:23 -0700 | [diff] [blame] | 1 | git-log(1) |
| 2 | ========== |
Junio C Hamano | 3f971fc | 2005-08-14 17:24:36 -0700 | [diff] [blame] | 3 | |
| 4 | NAME |
| 5 | ---- |
Junio C Hamano | 215a7ad | 2005-09-07 17:26:23 -0700 | [diff] [blame] | 6 | git-log - Show commit logs |
Junio C Hamano | 3f971fc | 2005-08-14 17:24:36 -0700 | [diff] [blame] | 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
Martin von Zweigbergk | 7791a1d | 2011-07-01 22:38:26 -0400 | [diff] [blame] | 11 | [verse] |
Ramkumar Ramachandra | 21a40b9 | 2013-04-22 11:00:28 +0530 | [diff] [blame] | 12 | 'git log' [<options>] [<revision range>] [[\--] <path>...] |
Junio C Hamano | 3f971fc | 2005-08-14 17:24:36 -0700 | [diff] [blame] | 13 | |
| 14 | DESCRIPTION |
| 15 | ----------- |
Junio C Hamano | e51c3b5 | 2006-04-14 12:59:09 -0700 | [diff] [blame] | 16 | Shows the commit logs. |
Junio C Hamano | 3f971fc | 2005-08-14 17:24:36 -0700 | [diff] [blame] | 17 | |
Jason St. John | b20cc13 | 2013-11-13 01:21:49 -0500 | [diff] [blame] | 18 | The command takes options applicable to the `git rev-list` |
Junio C Hamano | e51c3b5 | 2006-04-14 12:59:09 -0700 | [diff] [blame] | 19 | command to control what is shown and how, and options applicable to |
Jason St. John | b20cc13 | 2013-11-13 01:21:49 -0500 | [diff] [blame] | 20 | the `git diff-*` commands to control how the changes |
Junio C Hamano | e51c3b5 | 2006-04-14 12:59:09 -0700 | [diff] [blame] | 21 | each commit introduces are shown. |
| 22 | |
Junio C Hamano | 3f971fc | 2005-08-14 17:24:36 -0700 | [diff] [blame] | 23 | |
| 24 | OPTIONS |
| 25 | ------- |
Chris Riddoch | 5d1faf8 | 2006-11-21 16:49:15 -0700 | [diff] [blame] | 26 | |
Eli Barzilay | 4ded691 | 2010-07-07 22:14:31 -0400 | [diff] [blame] | 27 | --follow:: |
| 28 | Continue listing the history of a file beyond renames |
| 29 | (works only for a single file). |
| 30 | |
Junio C Hamano | 8a3d203 | 2010-02-17 10:20:49 -0800 | [diff] [blame] | 31 | --no-decorate:: |
Ramsay Jones | 462cbb4 | 2016-05-27 16:56:02 +0100 | [diff] [blame] | 32 | --decorate[=short|full|auto|no]:: |
Lars Hjemli | 33e7018 | 2009-08-15 16:23:12 +0200 | [diff] [blame] | 33 | 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 Jones | 462cbb4 | 2016-05-27 16:56:02 +0100 | [diff] [blame] | 36 | 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 Hendricks | 56822cc | 2007-05-10 16:09:38 -0600 | [diff] [blame] | 40 | |
Nanako Shiraishi | 30c4d7a | 2008-11-10 18:58:15 +0900 | [diff] [blame] | 41 | --source:: |
| 42 | Print out the ref name given on the command line by which each |
| 43 | commit was reached. |
| 44 | |
Antoine Pelisse | ea57bc0 | 2013-01-05 22:26:43 +0100 | [diff] [blame] | 45 | --use-mailmap:: |
| 46 | Use mailmap file to map author and committer names and email |
Jason St. John | b20cc13 | 2013-11-13 01:21:49 -0500 | [diff] [blame] | 47 | addresses to canonical real names and email addresses. See |
Antoine Pelisse | ea57bc0 | 2013-01-05 22:26:43 +0100 | [diff] [blame] | 48 | linkgit:git-shortlog[1]. |
| 49 | |
Jakub Narebski | 2e88c26 | 2007-06-16 21:03:38 +0200 | [diff] [blame] | 50 | --full-diff:: |
Jason St. John | b20cc13 | 2013-11-13 01:21:49 -0500 | [diff] [blame] | 51 | Without this flag, `git log -p <path>...` shows commits that |
Jakub Narebski | 2e88c26 | 2007-06-16 21:03:38 +0200 | [diff] [blame] | 52 | 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-Sen | f448e24 | 2008-07-30 15:03:43 +0530 | [diff] [blame] | 54 | the specified paths; this means that "<path>..." limits only |
Jakub Narebski | 2e88c26 | 2007-06-16 21:03:38 +0200 | [diff] [blame] | 55 | commits, and doesn't limit diff for those commits. |
Michael J Gruber | b1c7946 | 2010-08-08 17:31:34 +0200 | [diff] [blame] | 56 | + |
| 57 | Note that this affects all diff-based output types, e.g. those |
Jason St. John | b20cc13 | 2013-11-13 01:21:49 -0500 | [diff] [blame] | 58 | produced by `--stat`, etc. |
Jakub Narebski | 2e88c26 | 2007-06-16 21:03:38 +0200 | [diff] [blame] | 59 | |
Marco Costalba | 9fa3465 | 2007-07-20 20:15:13 +0200 | [diff] [blame] | 60 | --log-size:: |
Jason St. John | c20e6fb | 2013-11-13 01:21:48 -0500 | [diff] [blame] | 61 | 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 Costalba | 9fa3465 | 2007-07-20 20:15:13 +0200 | [diff] [blame] | 65 | |
Eric Sunshine | 1e15983 | 2013-08-06 09:59:34 -0400 | [diff] [blame] | 66 | -L <start>,<end>:<file>:: |
Matthieu Moy | d349e0e | 2015-04-20 14:09:06 +0200 | [diff] [blame] | 67 | -L :<funcname>:<file>:: |
Thomas Rast | 12da1d1 | 2013-03-28 17:47:32 +0100 | [diff] [blame] | 68 | Trace the evolution of the line range given by "<start>,<end>" |
Matthieu Moy | d349e0e | 2015-04-20 14:09:06 +0200 | [diff] [blame] | 69 | (or the function name regex <funcname>) within the <file>. You may |
Thomas Rast | 13b8f68 | 2013-03-28 17:47:33 +0100 | [diff] [blame] | 70 | 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 Hamano | 0f48343 | 2013-04-21 19:40:49 -0700 | [diff] [blame] | 73 | You can specify this option more than once. |
| 74 | + |
Thomas Rast | 12da1d1 | 2013-03-28 17:47:32 +0100 | [diff] [blame] | 75 | include::line-range-format.txt[] |
Thomas Rast | 12da1d1 | 2013-03-28 17:47:32 +0100 | [diff] [blame] | 76 | |
Ramkumar Ramachandra | 21a40b9 | 2013-04-22 11:00:28 +0530 | [diff] [blame] | 77 | <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. John | b20cc13 | 2013-11-13 01:21:49 -0500 | [diff] [blame] | 83 | ways to spell <revision range>, see the 'Specifying Ranges' |
Ramkumar Ramachandra | 21a40b9 | 2013-04-22 11:00:28 +0530 | [diff] [blame] | 84 | section of linkgit:gitrevisions[7]. |
Ramkumar Ramachandra | a682187 | 2013-04-22 11:00:27 +0530 | [diff] [blame] | 85 | |
martin f. krafft | b1524ee | 2008-09-30 21:57:50 +0200 | [diff] [blame] | 86 | [\--] <path>...:: |
Thomas Rast | b15b5b1 | 2011-08-30 11:21:07 +0200 | [diff] [blame] | 87 | Show only commits that are enough to explain how the files |
Jason St. John | b20cc13 | 2013-11-13 01:21:49 -0500 | [diff] [blame] | 88 | that match the specified paths came to be. See 'History |
| 89 | Simplification' below for details and other simplification |
Thomas Rast | b15b5b1 | 2011-08-30 11:21:07 +0200 | [diff] [blame] | 90 | modes. |
| 91 | + |
Jason St. John | b20cc13 | 2013-11-13 01:21:49 -0500 | [diff] [blame] | 92 | Paths may need to be prefixed with ``\-- '' to separate them from |
Ramkumar Ramachandra | 00200e9 | 2013-04-22 11:00:29 +0530 | [diff] [blame] | 93 | options or the revision range, when confusion arises. |
Junio C Hamano | e51c3b5 | 2006-04-14 12:59:09 -0700 | [diff] [blame] | 94 | |
Miklos Vajna | fdcf39e | 2008-01-18 23:58:57 +0100 | [diff] [blame] | 95 | include::rev-list-options.txt[] |
| 96 | |
Jakub Narebski | 331b51d | 2007-05-14 01:25:45 +0200 | [diff] [blame] | 97 | include::pretty-formats.txt[] |
| 98 | |
Matthieu Moy | 4ba258b | 2013-07-16 10:05:40 +0200 | [diff] [blame] | 99 | COMMON DIFF OPTIONS |
Michael J Gruber | f98fd43 | 2011-03-08 09:31:26 +0100 | [diff] [blame] | 100 | ------------------- |
| 101 | |
| 102 | :git-log: 1 |
| 103 | include::diff-options.txt[] |
| 104 | |
Miklos Vajna | 272bd3c | 2007-11-01 15:57:40 +0100 | [diff] [blame] | 105 | include::diff-generate-patch.txt[] |
Jakub Narebski | 331b51d | 2007-05-14 01:25:45 +0200 | [diff] [blame] | 106 | |
Matthieu Moy | 4ba258b | 2013-07-16 10:05:40 +0200 | [diff] [blame] | 107 | EXAMPLES |
Linus Torvalds | bd66361 | 2005-10-30 20:05:32 -0800 | [diff] [blame] | 108 | -------- |
Jeff King | 5d2fc91 | 2011-08-03 20:13:29 -0600 | [diff] [blame] | 109 | `git log --no-merges`:: |
Linus Torvalds | bd66361 | 2005-10-30 20:05:32 -0800 | [diff] [blame] | 110 | |
| 111 | Show the whole commit history, but skip any merges |
| 112 | |
Jeff King | 5d2fc91 | 2011-08-03 20:13:29 -0600 | [diff] [blame] | 113 | `git log v2.6.12.. include/scsi drivers/scsi`:: |
Linus Torvalds | bd66361 | 2005-10-30 20:05:32 -0800 | [diff] [blame] | 114 | |
| 115 | Show all commits since version 'v2.6.12' that changed any file |
Jason St. John | b20cc13 | 2013-11-13 01:21:49 -0500 | [diff] [blame] | 116 | in the `include/scsi` or `drivers/scsi` subdirectories |
Linus Torvalds | bd66361 | 2005-10-30 20:05:32 -0800 | [diff] [blame] | 117 | |
Jeff King | 6cf378f | 2012-04-26 04:51:57 -0400 | [diff] [blame] | 118 | `git log --since="2 weeks ago" -- gitk`:: |
Linus Torvalds | bd66361 | 2005-10-30 20:05:32 -0800 | [diff] [blame] | 119 | |
| 120 | Show the changes during the last two weeks to the file 'gitk'. |
Jason St. John | b20cc13 | 2013-11-13 01:21:49 -0500 | [diff] [blame] | 121 | The ``--'' is necessary to avoid confusion with the *branch* named |
Linus Torvalds | bd66361 | 2005-10-30 20:05:32 -0800 | [diff] [blame] | 122 | 'gitk' |
| 123 | |
Jeff King | 5d2fc91 | 2011-08-03 20:13:29 -0600 | [diff] [blame] | 124 | `git log --name-status release..test`:: |
Junio C Hamano | e51c3b5 | 2006-04-14 12:59:09 -0700 | [diff] [blame] | 125 | |
| 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 Torvalds | bd66361 | 2005-10-30 20:05:32 -0800 | [diff] [blame] | 129 | |
Phil Hord | 09b7e22 | 2013-06-18 13:44:58 -0400 | [diff] [blame] | 130 | `git log --follow builtin/rev-list.c`:: |
Steven Walter | 4f50f6a | 2007-07-12 10:52:30 -0400 | [diff] [blame] | 131 | |
Jason St. John | b20cc13 | 2013-11-13 01:21:49 -0500 | [diff] [blame] | 132 | Shows the commits that changed `builtin/rev-list.c`, including |
Steven Walter | 4f50f6a | 2007-07-12 10:52:30 -0400 | [diff] [blame] | 133 | those commits that occurred before the file was given its |
| 134 | present name. |
| 135 | |
Jeff King | 5d2fc91 | 2011-08-03 20:13:29 -0600 | [diff] [blame] | 136 | `git log --branches --not --remotes=origin`:: |
Ilari Liusvaara | d08bae7 | 2010-01-20 11:48:25 +0200 | [diff] [blame] | 137 | |
| 138 | Shows all commits that are in any of local branches but not in |
Matthieu Moy | 0e615b2 | 2010-11-02 16:31:20 +0100 | [diff] [blame] | 139 | any of remote-tracking branches for 'origin' (what you have that |
Ilari Liusvaara | d08bae7 | 2010-01-20 11:48:25 +0200 | [diff] [blame] | 140 | origin doesn't). |
| 141 | |
Jeff King | 5d2fc91 | 2011-08-03 20:13:29 -0600 | [diff] [blame] | 142 | `git log master --not --remotes=*/master`:: |
Ilari Liusvaara | d08bae7 | 2010-01-20 11:48:25 +0200 | [diff] [blame] | 143 | |
| 144 | Shows all commits that are in local master but not in any remote |
| 145 | repository master branches. |
| 146 | |
Jeff King | 5d2fc91 | 2011-08-03 20:13:29 -0600 | [diff] [blame] | 147 | `git log -p -m --first-parent`:: |
Petr Baudis | 88d9d45 | 2010-02-10 02:11:49 +0100 | [diff] [blame] | 148 | |
| 149 | Shows the history including change diffs, but only from the |
Jason St. John | b20cc13 | 2013-11-13 01:21:49 -0500 | [diff] [blame] | 150 | ``main branch'' perspective, skipping commits that come from merged |
Petr Baudis | 88d9d45 | 2010-02-10 02:11:49 +0100 | [diff] [blame] | 151 | 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 Sunshine | 001b097 | 2013-07-15 20:10:36 -0400 | [diff] [blame] | 155 | `git log -L '/int main/',/^}/:main.c`:: |
Thomas Rast | 12da1d1 | 2013-03-28 17:47:32 +0100 | [diff] [blame] | 156 | |
Jason St. John | b20cc13 | 2013-11-13 01:21:49 -0500 | [diff] [blame] | 157 | Shows how the function `main()` in the file `main.c` evolved |
Thomas Rast | 12da1d1 | 2013-03-28 17:47:32 +0100 | [diff] [blame] | 158 | over time. |
| 159 | |
Nguyễn Thái Ngọc Duy | 70c2a25 | 2012-09-06 21:28:03 +0700 | [diff] [blame] | 160 | `git log -3`:: |
Jason St. John | b20cc13 | 2013-11-13 01:21:49 -0500 | [diff] [blame] | 161 | |
Nguyễn Thái Ngọc Duy | 70c2a25 | 2012-09-06 21:28:03 +0700 | [diff] [blame] | 162 | Limits the number of commits to show to 3. |
Petr Baudis | 88d9d45 | 2010-02-10 02:11:49 +0100 | [diff] [blame] | 163 | |
Matthieu Moy | 4ba258b | 2013-07-16 10:05:40 +0200 | [diff] [blame] | 164 | DISCUSSION |
Junio C Hamano | 5dc7bcc | 2006-12-30 02:22:38 -0800 | [diff] [blame] | 165 | ---------- |
| 166 | |
| 167 | include::i18n.txt[] |
| 168 | |
Matthieu Moy | 4ba258b | 2013-07-16 10:05:40 +0200 | [diff] [blame] | 169 | CONFIGURATION |
Jonathan Nieder | 59893a8 | 2010-05-08 22:30:41 -0500 | [diff] [blame] | 170 | ------------- |
| 171 | |
| 172 | See linkgit:git-config[1] for core variables and linkgit:git-diff[1] |
| 173 | for settings related to diff generation. |
| 174 | |
| 175 | format.pretty:: |
Jason St. John | b20cc13 | 2013-11-13 01:21:49 -0500 | [diff] [blame] | 176 | Default for the `--format` option. (See 'Pretty Formats' above.) |
| 177 | Defaults to `medium`. |
Jonathan Nieder | 59893a8 | 2010-05-08 22:30:41 -0500 | [diff] [blame] | 178 | |
| 179 | i18n.logOutputEncoding:: |
Jason St. John | b20cc13 | 2013-11-13 01:21:49 -0500 | [diff] [blame] | 180 | Encoding to use when displaying logs. (See 'Discussion' above.) |
| 181 | Defaults to the value of `i18n.commitEncoding` if set, and UTF-8 |
Jonathan Nieder | 59893a8 | 2010-05-08 22:30:41 -0500 | [diff] [blame] | 182 | otherwise. |
| 183 | |
| 184 | log.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 Turner | 076c983 | 2015-07-07 21:29:34 -0400 | [diff] [blame] | 189 | log.follow:: |
Eric N. Vander Weele | fd8d07e | 2015-10-06 21:14:33 -0400 | [diff] [blame] | 190 | 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 Turner | 076c983 | 2015-07-07 21:29:34 -0400 | [diff] [blame] | 194 | |
Nguyễn Thái Ngọc Duy | da0005b | 2015-03-11 16:32:45 -0400 | [diff] [blame] | 195 | log.showRoot:: |
Jason St. John | b20cc13 | 2013-11-13 01:21:49 -0500 | [diff] [blame] | 196 | If `false`, `git log` and related commands will not treat the |
Jonathan Nieder | 59893a8 | 2010-05-08 22:30:41 -0500 | [diff] [blame] | 197 | 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 Jain | fce04c3 | 2016-06-22 22:21:26 +0530 | [diff] [blame] | 201 | log.showSignature:: |
| 202 | If `true`, `git log` and related commands will act as if the |
| 203 | `--show-signature` option was passed to them. |
| 204 | |
Jeff King | d5422b0 | 2012-12-13 08:08:12 -0500 | [diff] [blame] | 205 | mailmap.*:: |
Jonathan Nieder | 59893a8 | 2010-05-08 22:30:41 -0500 | [diff] [blame] | 206 | See linkgit:git-shortlog[1]. |
| 207 | |
| 208 | notes.displayRef:: |
| 209 | Which refs, in addition to the default set by `core.notesRef` |
Tom Russello | eee7f4a | 2016-06-08 00:35:06 +0200 | [diff] [blame] | 210 | or `GIT_NOTES_REF`, to read notes from when showing commit |
Jason St. John | b20cc13 | 2013-11-13 01:21:49 -0500 | [diff] [blame] | 211 | messages with the `log` family of commands. See |
Jonathan Nieder | 59893a8 | 2010-05-08 22:30:41 -0500 | [diff] [blame] | 212 | linkgit:git-notes[1]. |
| 213 | + |
| 214 | May be an unabbreviated ref name or a glob and may be specified |
| 215 | multiple times. A warning will be issued for refs that do not exist, |
| 216 | but a glob that does not match any refs is silently ignored. |
| 217 | + |
Johan Herland | ab18b2c | 2011-03-30 02:57:19 +0200 | [diff] [blame] | 218 | This setting can be disabled by the `--no-notes` option, |
Tom Russello | eee7f4a | 2016-06-08 00:35:06 +0200 | [diff] [blame] | 219 | overridden by the `GIT_NOTES_DISPLAY_REF` environment variable, |
Johan Herland | ab18b2c | 2011-03-30 02:57:19 +0200 | [diff] [blame] | 220 | and overridden by the `--notes=<ref>` option. |
Junio C Hamano | 5dc7bcc | 2006-12-30 02:22:38 -0800 | [diff] [blame] | 221 | |
Junio C Hamano | 3f971fc | 2005-08-14 17:24:36 -0700 | [diff] [blame] | 222 | GIT |
| 223 | --- |
Christian Couder | 9e1f0a8 | 2008-06-06 09:07:32 +0200 | [diff] [blame] | 224 | Part of the linkgit:git[1] suite |