]> git.ipfire.org Git - thirdparty/git.git/blob - Documentation/git-log.txt
The fifth batch
[thirdparty/git.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 [verse]
12 'git log' [<options>] [<revision-range>] [[--] <path>...]
13
14 DESCRIPTION
15 -----------
16 Shows the commit logs.
17
18 :git-log: 1
19 include::rev-list-description.txt[]
20
21 The command takes options applicable to the linkgit:git-rev-list[1]
22 command to control what is shown and how, and options applicable to
23 the linkgit:git-diff[1] command to control how the changes
24 each commit introduces are shown.
25
26
27 OPTIONS
28 -------
29
30 --follow::
31 Continue listing the history of a file beyond renames
32 (works only for a single file).
33
34 --no-decorate::
35 --decorate[=short|full|auto|no]::
36 Print out the ref names of any commits that are shown. If 'short' is
37 specified, the ref name prefixes 'refs/heads/', 'refs/tags/' and
38 'refs/remotes/' will not be printed. If 'full' is specified, the
39 full ref name (including prefix) will be printed. If 'auto' is
40 specified, then if the output is going to a terminal, the ref names
41 are shown as if 'short' were given, otherwise no ref names are
42 shown. The option `--decorate` is short-hand for `--decorate=short`.
43 Default to configuration value of `log.decorate` if configured,
44 otherwise, `auto`.
45
46 --decorate-refs=<pattern>::
47 --decorate-refs-exclude=<pattern>::
48 For each candidate reference, do not use it for decoration if it
49 matches any patterns given to `--decorate-refs-exclude` or if it
50 doesn't match any of the patterns given to `--decorate-refs`. The
51 `log.excludeDecoration` config option allows excluding refs from
52 the decorations, but an explicit `--decorate-refs` pattern will
53 override a match in `log.excludeDecoration`.
54 +
55 If none of these options or config settings are given, then references are
56 used as decoration if they match `HEAD`, `refs/heads/`, `refs/remotes/`,
57 `refs/stash/`, or `refs/tags/`.
58
59 --clear-decorations::
60 When specified, this option clears all previous `--decorate-refs`
61 or `--decorate-refs-exclude` options and relaxes the default
62 decoration filter to include all references. This option is
63 assumed if the config value `log.initialDecorationSet` is set to
64 `all`.
65
66 --source::
67 Print out the ref name given on the command line by which each
68 commit was reached.
69
70 --[no-]mailmap::
71 --[no-]use-mailmap::
72 Use mailmap file to map author and committer names and email
73 addresses to canonical real names and email addresses. See
74 linkgit:git-shortlog[1].
75
76 --full-diff::
77 Without this flag, `git log -p <path>...` shows commits that
78 touch the specified paths, and diffs about the same specified
79 paths. With this, the full diff is shown for commits that touch
80 the specified paths; this means that "<path>..." limits only
81 commits, and doesn't limit diff for those commits.
82 +
83 Note that this affects all diff-based output types, e.g. those
84 produced by `--stat`, etc.
85
86 --log-size::
87 Include a line ``log size <number>'' in the output for each commit,
88 where <number> is the length of that commit's message in bytes.
89 Intended to speed up tools that read log messages from `git log`
90 output by allowing them to allocate space in advance.
91
92 include::line-range-options.txt[]
93
94 <revision-range>::
95 Show only commits in the specified revision range. When no
96 <revision-range> is specified, it defaults to `HEAD` (i.e. the
97 whole history leading to the current commit). `origin..HEAD`
98 specifies all the commits reachable from the current commit
99 (i.e. `HEAD`), but not from `origin`. For a complete list of
100 ways to spell <revision-range>, see the 'Specifying Ranges'
101 section of linkgit:gitrevisions[7].
102
103 [--] <path>...::
104 Show only commits that are enough to explain how the files
105 that match the specified paths came to be. See 'History
106 Simplification' below for details and other simplification
107 modes.
108 +
109 Paths may need to be prefixed with `--` to separate them from
110 options or the revision range, when confusion arises.
111
112 include::rev-list-options.txt[]
113
114 include::pretty-formats.txt[]
115
116 DIFF FORMATTING
117 ---------------
118
119 By default, `git log` does not generate any diff output. The options
120 below can be used to show the changes made by each commit.
121
122 Note that unless one of `--diff-merges` variants (including short
123 `-m`, `-c`, `--cc`, and `--dd` options) is explicitly given, merge commits
124 will not show a diff, even if a diff format like `--patch` is
125 selected, nor will they match search options like `-S`. The exception
126 is when `--first-parent` is in use, in which case `first-parent` is
127 the default format for merge commits.
128
129 :git-log: 1
130 :diff-merges-default: `off`
131 include::diff-options.txt[]
132
133 include::diff-generate-patch.txt[]
134
135 EXAMPLES
136 --------
137 `git log --no-merges`::
138
139 Show the whole commit history, but skip any merges
140
141 `git log v2.6.12.. include/scsi drivers/scsi`::
142
143 Show all commits since version 'v2.6.12' that changed any file
144 in the `include/scsi` or `drivers/scsi` subdirectories
145
146 `git log --since="2 weeks ago" -- gitk`::
147
148 Show the changes during the last two weeks to the file 'gitk'.
149 The `--` is necessary to avoid confusion with the *branch* named
150 'gitk'
151
152 `git log --name-status release..test`::
153
154 Show the commits that are in the "test" branch but not yet
155 in the "release" branch, along with the list of paths
156 each commit modifies.
157
158 `git log --follow builtin/rev-list.c`::
159
160 Shows the commits that changed `builtin/rev-list.c`, including
161 those commits that occurred before the file was given its
162 present name.
163
164 `git log --branches --not --remotes=origin`::
165
166 Shows all commits that are in any of local branches but not in
167 any of remote-tracking branches for 'origin' (what you have that
168 origin doesn't).
169
170 `git log master --not --remotes=*/master`::
171
172 Shows all commits that are in local master but not in any remote
173 repository master branches.
174
175 `git log -p -m --first-parent`::
176
177 Shows the history including change diffs, but only from the
178 ``main branch'' perspective, skipping commits that come from merged
179 branches, and showing full diffs of changes introduced by the merges.
180 This makes sense only when following a strict policy of merging all
181 topic branches when staying on a single integration branch.
182
183 `git log -L '/int main/',/^}/:main.c`::
184
185 Shows how the function `main()` in the file `main.c` evolved
186 over time.
187
188 `git log -3`::
189
190 Limits the number of commits to show to 3.
191
192 DISCUSSION
193 ----------
194
195 include::i18n.txt[]
196
197 CONFIGURATION
198 -------------
199
200 See linkgit:git-config[1] for core variables and linkgit:git-diff[1]
201 for settings related to diff generation.
202
203 format.pretty::
204 Default for the `--format` option. (See 'Pretty Formats' above.)
205 Defaults to `medium`.
206
207 i18n.logOutputEncoding::
208 Encoding to use when displaying logs. (See 'Discussion' above.)
209 Defaults to the value of `i18n.commitEncoding` if set, and UTF-8
210 otherwise.
211
212 include::includes/cmd-config-section-rest.txt[]
213
214 include::config/log.txt[]
215
216 include::config/notes.txt[]
217
218 GIT
219 ---
220 Part of the linkgit:git[1] suite