Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | git-log(1) |
| 2 | ========== |
| 3 | |
| 4 | NAME |
| 5 | ---- |
| 6 | git-log - Show commit logs |
| 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
Junio C Hamano | 15567bc | 2011-07-23 00:51:59 | [diff] [blame] | 11 | [verse] |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 12 | 'git log' [<options>] [<since>..<until>] [[\--] <path>...] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 13 | |
| 14 | DESCRIPTION |
| 15 | ----------- |
Junio C Hamano | ba7c8d8 | 2006-04-15 06:17:42 | [diff] [blame] | 16 | Shows the commit logs. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 17 | |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 18 | The command takes options applicable to the 'git rev-list' |
Junio C Hamano | ba7c8d8 | 2006-04-15 06:17:42 | [diff] [blame] | 19 | command to control what is shown and how, and options applicable to |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 20 | the 'git diff-*' commands to control how the changes |
Junio C Hamano | ba7c8d8 | 2006-04-15 06:17:42 | [diff] [blame] | 21 | each commit introduces are shown. |
| 22 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 23 | |
| 24 | OPTIONS |
| 25 | ------- |
Junio C Hamano | a340aaa | 2006-11-23 02:47:33 | [diff] [blame] | 26 | |
Junio C Hamano | edd2b0a | 2007-01-15 06:12:45 | [diff] [blame] | 27 | -<n>:: |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 28 | Limits the number of commits to show. |
Junio C Hamano | d2c978f | 2011-03-20 19:42:22 | [diff] [blame] | 29 | Note that this is a commit limiting option, see below. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 30 | |
| 31 | <since>..<until>:: |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 32 | Show only commits between the named two commits. When |
| 33 | either <since> or <until> is omitted, it defaults to |
| 34 | `HEAD`, i.e. the tip of the current branch. |
Junio C Hamano | 2d47c62 | 2007-01-18 06:24:10 | [diff] [blame] | 35 | For a more complete list of ways to spell <since> |
Junio C Hamano | c27b733 | 2010-10-14 04:37:28 | [diff] [blame] | 36 | and <until>, see linkgit:gitrevisions[7]. |
Junio C Hamano | 78e3a78 | 2010-07-15 22:24:45 | [diff] [blame] | 37 | |
| 38 | --follow:: |
| 39 | Continue listing the history of a file beyond renames |
| 40 | (works only for a single file). |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 41 | |
Junio C Hamano | cb39aea | 2010-05-09 07:24:48 | [diff] [blame] | 42 | --no-decorate:: |
| 43 | --decorate[=short|full|no]:: |
Junio C Hamano | c276ec7 | 2009-08-26 01:35:22 | [diff] [blame] | 44 | Print out the ref names of any commits that are shown. If 'short' is |
| 45 | specified, the ref name prefixes 'refs/heads/', 'refs/tags/' and |
| 46 | 'refs/remotes/' will not be printed. If 'full' is specified, the |
| 47 | full ref name (including prefix) will be printed. The default option |
| 48 | is 'short'. |
Junio C Hamano | ee695f2 | 2007-06-21 00:35:36 | [diff] [blame] | 49 | |
Junio C Hamano | 2836349 | 2008-11-14 08:26:31 | [diff] [blame] | 50 | --source:: |
| 51 | Print out the ref name given on the command line by which each |
| 52 | commit was reached. |
| 53 | |
Junio C Hamano | ee695f2 | 2007-06-21 00:35:36 | [diff] [blame] | 54 | --full-diff:: |
Junio C Hamano | 9e39507 | 2008-07-31 22:11:21 | [diff] [blame] | 55 | Without this flag, "git log -p <path>..." shows commits that |
Junio C Hamano | ee695f2 | 2007-06-21 00:35:36 | [diff] [blame] | 56 | touch the specified paths, and diffs about the same specified |
| 57 | paths. With this, the full diff is shown for commits that touch |
Junio C Hamano | 9e39507 | 2008-07-31 22:11:21 | [diff] [blame] | 58 | the specified paths; this means that "<path>..." limits only |
Junio C Hamano | ee695f2 | 2007-06-21 00:35:36 | [diff] [blame] | 59 | commits, and doesn't limit diff for those commits. |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 60 | + |
| 61 | Note that this affects all diff-based output types, e.g. those |
| 62 | produced by --stat etc. |
Junio C Hamano | ea5dae6 | 2007-05-10 23:25:08 | [diff] [blame] | 63 | |
Junio C Hamano | 024b6c6 | 2007-08-14 09:43:08 | [diff] [blame] | 64 | --log-size:: |
| 65 | Before the log message print out its size in bytes. Intended |
| 66 | mainly for porcelain tools consumption. If git is unable to |
| 67 | produce a valid value size is set to zero. |
| 68 | Note that only message is considered, if also a diff is shown |
| 69 | its size is not included. |
| 70 | |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 71 | [\--] <path>...:: |
Junio C Hamano | 5723afa | 2011-08-31 00:49:23 | [diff] [blame] | 72 | Show only commits that are enough to explain how the files |
| 73 | that match the specified paths came to be. See "History |
| 74 | Simplification" below for details and other simplification |
| 75 | modes. |
| 76 | + |
| 77 | To prevent confusion with options and branch names, paths may need to |
| 78 | be prefixed with "\-- " to separate them from options or refnames. |
Junio C Hamano | ba7c8d8 | 2006-04-15 06:17:42 | [diff] [blame] | 79 | |
Junio C Hamano | b0e0295 | 2008-01-19 08:02:00 | [diff] [blame] | 80 | include::rev-list-options.txt[] |
| 81 | |
Junio C Hamano | 0430e3a | 2007-05-15 03:13:17 | [diff] [blame] | 82 | include::pretty-formats.txt[] |
| 83 | |
Junio C Hamano | d2c978f | 2011-03-20 19:42:22 | [diff] [blame] | 84 | Common diff options |
| 85 | ------------------- |
| 86 | |
| 87 | :git-log: 1 |
| 88 | include::diff-options.txt[] |
| 89 | |
Junio C Hamano | 00b8b63 | 2007-12-07 09:50:49 | [diff] [blame] | 90 | include::diff-generate-patch.txt[] |
Junio C Hamano | 0430e3a | 2007-05-15 03:13:17 | [diff] [blame] | 91 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 92 | Examples |
| 93 | -------- |
Junio C Hamano | 16ebcd0 | 2011-08-05 00:05:45 | [diff] [blame] | 94 | `git log --no-merges`:: |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 95 | |
| 96 | Show the whole commit history, but skip any merges |
| 97 | |
Junio C Hamano | 16ebcd0 | 2011-08-05 00:05:45 | [diff] [blame] | 98 | `git log v2.6.12.. include/scsi drivers/scsi`:: |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 99 | |
| 100 | Show all commits since version 'v2.6.12' that changed any file |
| 101 | in the include/scsi or drivers/scsi subdirectories |
| 102 | |
Junio C Hamano | b76a686 | 2012-05-02 22:02:46 | [diff] [blame] | 103 | `git log --since="2 weeks ago" -- gitk`:: |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 104 | |
| 105 | Show the changes during the last two weeks to the file 'gitk'. |
| 106 | The "--" is necessary to avoid confusion with the *branch* named |
| 107 | 'gitk' |
| 108 | |
Junio C Hamano | 16ebcd0 | 2011-08-05 00:05:45 | [diff] [blame] | 109 | `git log --name-status release..test`:: |
Junio C Hamano | ba7c8d8 | 2006-04-15 06:17:42 | [diff] [blame] | 110 | |
| 111 | Show the commits that are in the "test" branch but not yet |
| 112 | in the "release" branch, along with the list of paths |
| 113 | each commit modifies. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 114 | |
Junio C Hamano | 16ebcd0 | 2011-08-05 00:05:45 | [diff] [blame] | 115 | `git log --follow builtin-rev-list.c`:: |
Junio C Hamano | 235d53f | 2007-07-13 00:25:15 | [diff] [blame] | 116 | |
| 117 | Shows the commits that changed builtin-rev-list.c, including |
| 118 | those commits that occurred before the file was given its |
| 119 | present name. |
| 120 | |
Junio C Hamano | 16ebcd0 | 2011-08-05 00:05:45 | [diff] [blame] | 121 | `git log --branches --not --remotes=origin`:: |
Junio C Hamano | 57827fb | 2010-01-23 03:02:50 | [diff] [blame] | 122 | |
| 123 | Shows all commits that are in any of local branches but not in |
Junio C Hamano | 97bcb48 | 2010-11-25 03:16:07 | [diff] [blame] | 124 | any of remote-tracking branches for 'origin' (what you have that |
Junio C Hamano | 57827fb | 2010-01-23 03:02:50 | [diff] [blame] | 125 | origin doesn't). |
| 126 | |
Junio C Hamano | 16ebcd0 | 2011-08-05 00:05:45 | [diff] [blame] | 127 | `git log master --not --remotes=*/master`:: |
Junio C Hamano | 57827fb | 2010-01-23 03:02:50 | [diff] [blame] | 128 | |
| 129 | Shows all commits that are in local master but not in any remote |
| 130 | repository master branches. |
| 131 | |
Junio C Hamano | 16ebcd0 | 2011-08-05 00:05:45 | [diff] [blame] | 132 | `git log -p -m --first-parent`:: |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 133 | |
| 134 | Shows the history including change diffs, but only from the |
| 135 | "main branch" perspective, skipping commits that come from merged |
| 136 | branches, and showing full diffs of changes introduced by the merges. |
| 137 | This makes sense only when following a strict policy of merging all |
| 138 | topic branches when staying on a single integration branch. |
| 139 | |
| 140 | |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 141 | Discussion |
| 142 | ---------- |
| 143 | |
| 144 | include::i18n.txt[] |
| 145 | |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 146 | Configuration |
| 147 | ------------- |
| 148 | |
| 149 | See linkgit:git-config[1] for core variables and linkgit:git-diff[1] |
| 150 | for settings related to diff generation. |
| 151 | |
| 152 | format.pretty:: |
| 153 | Default for the `--format` option. (See "PRETTY FORMATS" above.) |
| 154 | Defaults to "medium". |
| 155 | |
| 156 | i18n.logOutputEncoding:: |
| 157 | Encoding to use when displaying logs. (See "Discussion", above.) |
| 158 | Defaults to the value of `i18n.commitEncoding` if set, UTF-8 |
| 159 | otherwise. |
| 160 | |
| 161 | log.date:: |
| 162 | Default format for human-readable dates. (Compare the |
| 163 | `--date` option.) Defaults to "default", which means to write |
| 164 | dates like `Sat May 8 19:35:34 2010 -0500`. |
| 165 | |
| 166 | log.showroot:: |
| 167 | If `false`, 'git log' and related commands will not treat the |
| 168 | initial commit as a big creation event. Any root commits in |
| 169 | `git log -p` output would be shown without a diff attached. |
| 170 | The default is `true`. |
| 171 | |
| 172 | mailmap.file:: |
| 173 | See linkgit:git-shortlog[1]. |
| 174 | |
| 175 | notes.displayRef:: |
| 176 | Which refs, in addition to the default set by `core.notesRef` |
| 177 | or 'GIT_NOTES_REF', to read notes from when showing commit |
| 178 | messages with the 'log' family of commands. See |
| 179 | linkgit:git-notes[1]. |
| 180 | + |
| 181 | May be an unabbreviated ref name or a glob and may be specified |
| 182 | multiple times. A warning will be issued for refs that do not exist, |
| 183 | but a glob that does not match any refs is silently ignored. |
| 184 | + |
Junio C Hamano | 6003346 | 2011-05-03 00:48:43 | [diff] [blame] | 185 | This setting can be disabled by the `--no-notes` option, |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 186 | overridden by the 'GIT_NOTES_DISPLAY_REF' environment variable, |
Junio C Hamano | 6003346 | 2011-05-03 00:48:43 | [diff] [blame] | 187 | and overridden by the `--notes=<ref>` option. |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 188 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 189 | GIT |
| 190 | --- |
Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 191 | Part of the linkgit:git[1] suite |