]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-log.txt
Merge branch 'js/update-urls-in-doc-and-comment' into maint-2.43
[thirdparty/git.git] / Documentation / git-log.txt
CommitLineData
215a7ad1
JH
1git-log(1)
2==========
3f971fc4
JH
3
4NAME
5----
215a7ad1 6git-log - Show commit logs
3f971fc4
JH
7
8
9SYNOPSIS
10--------
7791a1d9 11[verse]
133db54d 12'git log' [<options>] [<revision-range>] [[--] <path>...]
3f971fc4
JH
13
14DESCRIPTION
15-----------
e51c3b50
JH
16Shows the commit logs.
17
bea86658
PB
18:git-log: 1
19include::rev-list-description.txt[]
20
f8f28ed9 21The command takes options applicable to the linkgit:git-rev-list[1]
e51c3b50 22command to control what is shown and how, and options applicable to
f8f28ed9 23the linkgit:git-diff[1] command to control how the changes
e51c3b50
JH
24each commit introduces are shown.
25
3f971fc4
JH
26
27OPTIONS
28-------
5d1faf87 29
4ded6916
EB
30--follow::
31 Continue listing the history of a file beyond renames
32 (works only for a single file).
33
8a3d203b 34--no-decorate::
462cbb41 35--decorate[=short|full|auto|no]::
33e7018c
LH
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
462cbb41
RJ
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
a0538e5c
ĐTCD
42 shown. The option `--decorate` is short-hand for `--decorate=short`.
43 Default to configuration value of `log.decorate` if configured,
44 otherwise, `auto`.
56822cc9 45
65516f58
RA
46--decorate-refs=<pattern>::
47--decorate-refs-exclude=<pattern>::
92156291 48 For each candidate reference, do not use it for decoration if it
65516f58 49 matches any patterns given to `--decorate-refs-exclude` or if it
a6be5e67
DS
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`.
92156291
DS
54+
55If none of these options or config settings are given, then references are
56used as decoration if they match `HEAD`, `refs/heads/`, `refs/remotes/`,
57`refs/stash/`, or `refs/tags/`.
65516f58 58
748706d7
DS
59--clear-decorations::
60 When specified, this option clears all previous `--decorate-refs`
61 or `--decorate-refs-exclude` options and relaxes the default
3e103ed2
DS
62 decoration filter to include all references. This option is
63 assumed if the config value `log.initialDecorationSet` is set to
64 `all`.
748706d7 65
30c4d7a7
NS
66--source::
67 Print out the ref name given on the command line by which each
68 commit was reached.
69
88acccda 70--[no-]mailmap::
2d9c5690 71--[no-]use-mailmap::
ea57bc0d 72 Use mailmap file to map author and committer names and email
b20cc13e 73 addresses to canonical real names and email addresses. See
ea57bc0d
AP
74 linkgit:git-shortlog[1].
75
2e88c266 76--full-diff::
b20cc13e 77 Without this flag, `git log -p <path>...` shows commits that
2e88c266
JN
78 touch the specified paths, and diffs about the same specified
79 paths. With this, the full diff is shown for commits that touch
f448e24e 80 the specified paths; this means that "<path>..." limits only
2e88c266 81 commits, and doesn't limit diff for those commits.
b1c7946d
MG
82+
83Note that this affects all diff-based output types, e.g. those
b20cc13e 84produced by `--stat`, etc.
2e88c266 85
9fa3465d 86--log-size::
c20e6fb1
JSJ
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.
9fa3465d 91
f9c8d8cb 92include::line-range-options.txt[]
12da1d1f 93
133db54d 94<revision-range>::
21a40b90 95 Show only commits in the specified revision range. When no
133db54d 96 <revision-range> is specified, it defaults to `HEAD` (i.e. the
21a40b90
RR
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
133db54d 100 ways to spell <revision-range>, see the 'Specifying Ranges'
21a40b90 101 section of linkgit:gitrevisions[7].
a682187e 102
933c758c 103[--] <path>...::
b15b5b10 104 Show only commits that are enough to explain how the files
b20cc13e
JSJ
105 that match the specified paths came to be. See 'History
106 Simplification' below for details and other simplification
b15b5b10
TR
107 modes.
108+
6955047f 109Paths may need to be prefixed with `--` to separate them from
00200e9e 110options or the revision range, when confusion arises.
e51c3b50 111
f98fd436
MG
112include::rev-list-options.txt[]
113
114include::pretty-formats.txt[]
115
6f2e02ae
JK
116DIFF FORMATTING
117---------------
118
119By default, `git log` does not generate any diff output. The options
120below can be used to show the changes made by each commit.
121
b5ffa9ec 122Note that unless one of `--diff-merges` variants (including short
c8e5cb06 123`-m`, `-c`, `--cc`, and `--dd` options) is explicitly given, merge commits
b5ffa9ec
SO
124will not show a diff, even if a diff format like `--patch` is
125selected, nor will they match search options like `-S`. The exception
126is when `--first-parent` is in use, in which case `first-parent` is
be3820c6 127the default format for merge commits.
405a2fdf 128
4ded6916 129:git-log: 1
1d24509b 130:diff-merges-default: `off`
4ded6916 131include::diff-options.txt[]
331b51d2 132
272bd3cf 133include::diff-generate-patch.txt[]
331b51d2 134
4ba258b7 135EXAMPLES
bd663611 136--------
5d2fc913 137`git log --no-merges`::
bd663611
LT
138
139 Show the whole commit history, but skip any merges
140
5d2fc913 141`git log v2.6.12.. include/scsi drivers/scsi`::
bd663611
LT
142
143 Show all commits since version 'v2.6.12' that changed any file
b20cc13e 144 in the `include/scsi` or `drivers/scsi` subdirectories
bd663611 145
6cf378f0 146`git log --since="2 weeks ago" -- gitk`::
bd663611
LT
147
148 Show the changes during the last two weeks to the file 'gitk'.
6955047f 149 The `--` is necessary to avoid confusion with the *branch* named
bd663611
LT
150 'gitk'
151
5d2fc913 152`git log --name-status release..test`::
e51c3b50
JH
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.
bd663611 157
09b7e220 158`git log --follow builtin/rev-list.c`::
4f50f6a9 159
b20cc13e 160 Shows the commits that changed `builtin/rev-list.c`, including
4f50f6a9
SW
161 those commits that occurred before the file was given its
162 present name.
163
5d2fc913 164`git log --branches --not --remotes=origin`::
d08bae7e
IL
165
166 Shows all commits that are in any of local branches but not in
0e615b25 167 any of remote-tracking branches for 'origin' (what you have that
d08bae7e
IL
168 origin doesn't).
169
5d2fc913 170`git log master --not --remotes=*/master`::
d08bae7e
IL
171
172 Shows all commits that are in local master but not in any remote
173 repository master branches.
174
5d2fc913 175`git log -p -m --first-parent`::
88d9d45d
PB
176
177 Shows the history including change diffs, but only from the
b20cc13e 178 ``main branch'' perspective, skipping commits that come from merged
88d9d45d
PB
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
001b0976 183`git log -L '/int main/',/^}/:main.c`::
12da1d1f 184
b20cc13e 185 Shows how the function `main()` in the file `main.c` evolved
12da1d1f
TR
186 over time.
187
70c2a258 188`git log -3`::
b20cc13e 189
70c2a258 190 Limits the number of commits to show to 3.
88d9d45d 191
4ba258b7 192DISCUSSION
5dc7bcc2
JH
193----------
194
195include::i18n.txt[]
196
4ba258b7 197CONFIGURATION
59893a88
JN
198-------------
199
200See linkgit:git-config[1] for core variables and linkgit:git-diff[1]
201for settings related to diff generation.
202
203format.pretty::
b20cc13e
JSJ
204 Default for the `--format` option. (See 'Pretty Formats' above.)
205 Defaults to `medium`.
59893a88
JN
206
207i18n.logOutputEncoding::
b20cc13e
JSJ
208 Encoding to use when displaying logs. (See 'Discussion' above.)
209 Defaults to the value of `i18n.commitEncoding` if set, and UTF-8
59893a88
JN
210 otherwise.
211
5bd277e2
ÆAB
212include::includes/cmd-config-section-rest.txt[]
213
00c80534
ÆAB
214include::config/log.txt[]
215
5bd277e2 216include::config/notes.txt[]
5dc7bcc2 217
3f971fc4
JH
218GIT
219---
9e1f0a85 220Part of the linkgit:git[1] suite