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