1GIT-LOG(1) Git Manual GIT-LOG(1)
2
3
4
6 git-log - Show commit logs
7
9 git-log <option>...
10
12 Shows the commit logs.
13
14 The command takes options applicable to the git-rev-list(1) command to
15 control what is shown and how, and options applicable to the git-diff-
16 tree(1) commands to control how the changes each commit introduces are
17 shown.
18
19 This manual page describes only the most frequently used options.
20
22 --pretty[=<format>]
23 Pretty-print the contents of the commit logs in a given format,
24 where <format> can be one of oneline, short, medium, full, fuller,
25 email, raw and format:<string>. When omitted, the format defaults
26 to medium.
27
28 --abbrev-commit
29 Instead of showing the full 40-byte hexadecimal commit object name,
30 show only handful hexdigits prefix. Non default number of digits
31 can be specified with "--abbrev=<n>" (which also modifies diff
32 output, if it is displayed).
33
34 This should make "--pretty=oneline" a whole lot more readable for
35 people using 80-column terminals.
36
37 --encoding[=<encoding>]
38 The commit objects record the encoding used for the log message in
39 their encoding header; this option can be used to tell the command
40 to re-code the commit log message in the encoding preferred by the
41 user. For non plumbing commands this defaults to UTF-8.
42
43 -<n>
44 Limits the number of commits to show.
45
46 <since>..<until>
47 Show only commits between the named two commits. When either
48 <since> or <until> is omitted, it defaults to HEAD, i.e. the tip of
49 the current branch. For a more complete list of ways to spell
50 <since> and <until>, see "SPECIFYING REVISIONS" section in git-rev-
51 parse(1).
52
53 --first-parent
54 Follow only the first parent commit upon seeing a merge commit.
55 This option gives a better overview of the evolution of a
56 particular branch.
57
58 -p
59 Show the change the commit introduces in a patch form.
60
61 -g, --walk-reflogs
62 Show commits as they were recorded in the reflog. The log contains
63 a record about how the tip of a reference was changed. Cannot be
64 combined with --reverse. See also git-reflog(1).
65
66 --decorate
67 Print out the ref names of any commits that are shown.
68
69 --full-diff
70 Without this flag, "git log -p <paths>..." shows commits that touch
71 the specified paths, and diffs about the same specified paths. With
72 this, the full diff is shown for commits that touch the specified
73 paths; this means that "<paths>..." limits only commits, and
74 doesn´t limit diff for those commits.
75
76 --follow
77 Continue listing the history of a file beyond renames.
78
79 --log-size
80 Before the log message print out its size in bytes. Intended mainly
81 for porcelain tools consumption. If git is unable to produce a
82 valid value size is set to zero. Note that only message is
83 considered, if also a diff is shown its size is not included.
84
85 <paths>...
86 Show only commits that affect the specified paths.
87
89 If the commit is a merge, and if the pretty-format is not oneline,
90 email or raw, an additional line is inserted before the Author: line.
91 This line begins with "Merge: " and the sha1s of ancestral commits are
92 printed, separated by spaces. Note that the listed commits may not
93 necessarily be the list of the direct parent commits if you have
94 limited your view of history: for example, if you are only interested
95 in changes related to a certain directory or file.
96
97 Here are some additional details for each format:
98
99
100 · oneline
101
102
103 <sha1> <title line>
104 This is designed to be as compact as possible.
105
106 · short
107
108
109 commit <sha1>
110 Author: <author>
111
112 <title line>
113
114 · medium
115
116
117 commit <sha1>
118 Author: <author>
119 Date: <date>
120
121 <title line>
122
123 <full commit message>
124
125 · full
126
127
128 commit <sha1>
129 Author: <author>
130 Commit: <committer>
131
132 <title line>
133
134 <full commit message>
135
136 · fuller
137
138
139 commit <sha1>
140 Author: <author>
141 AuthorDate: <date & time>
142 Commit: <committer>
143 CommitDate: <date & time>
144
145 <title line>
146
147 <full commit message>
148
149 · email
150
151
152 From <sha1> <date>
153 From: <author>
154 Date: <date & time>
155 Subject: [PATCH] <title line>
156
157 <full commit message>
158
159 · raw
160
161 The raw format shows the entire commit exactly as stored in the
162 commit object. Notably, the SHA1s are displayed in full, regardless
163 of whether --abbrev or --no-abbrev are used, and parents
164 information show the true parent commits, without taking grafts nor
165 history simplification into account.
166
167 · format:
168
169 The format: format allows you to specify which information you want
170 to show. It works a little bit like printf format, with the notable
171 exception that you get a newline with %n instead of \n.
172
173 E.g, format:"The author of %h was %an, %ar%nThe title was >>%s<<%n"
174 would show something like this:
175
176
177
178 The author of fe6e0ee was Junio C Hamano, 23 hours ago
179 The title was >>t4119: test autocomputing -p<n> for traditional diff input.<<
180
181
182 The placeholders are:
183
184
185 · %H: commit hash
186
187 · %h: abbreviated commit hash
188
189 · %T: tree hash
190
191 · %t: abbreviated tree hash
192
193 · %P: parent hashes
194
195 · %p: abbreviated parent hashes
196
197 · %an: author name
198
199 · %ae: author email
200
201 · %ad: author date
202
203 · %aD: author date, RFC2822 style
204
205 · %ar: author date, relative
206
207 · %at: author date, UNIX timestamp
208
209 · %ai: author date, ISO 8601 format
210
211 · %cn: committer name
212
213 · %ce: committer email
214
215 · %cd: committer date
216
217 · %cD: committer date, RFC2822 style
218
219 · %cr: committer date, relative
220
221 · %ct: committer date, UNIX timestamp
222
223 · %ci: committer date, ISO 8601 format
224
225 · %e: encoding
226
227 · %s: subject
228
229 · %b: body
230
231 · %Cred: switch color to red
232
233 · %Cgreen: switch color to green
234
235 · %Cblue: switch color to blue
236
237 · %Creset: reset color
238
239 · %m: left, right or boundary mark
240
241 · %n: newline
242
244 git log --no-merges
245 Show the whole commit history, but skip any merges
246
247 git log v2.6.12.. include/scsi drivers/scsi
248 Show all commits since version v2.6.12 that changed any file in the
249 include/scsi or drivers/scsi subdirectories
250
251 git log --since="2 weeks ago" -- gitk
252 Show the changes during the last two weeks to the file gitk. The
253 "--" is necessary to avoid confusion with the branch named gitk
254
255 git log --name-status release..test
256 Show the commits that are in the "test" branch but not yet in the
257 "release" branch, along with the list of paths each commit
258 modifies.
259
260 git log --follow builtin-rev-list.c
261 Shows the commits that changed builtin-rev-list.c, including those
262 commits that occurred before the file was given its present name.
263
265 At the core level, git is character encoding agnostic.
266
267
268 · The pathnames recorded in the index and in the tree objects are
269 treated as uninterpreted sequences of non-NUL bytes. What
270 readdir(2) returns are what are recorded and compared with the data
271 git keeps track of, which in turn are expected to be what lstat(2)
272 and creat(2) accepts. There is no such thing as pathname encoding
273 translation.
274
275 · The contents of the blob objects are uninterpreted sequence of
276 bytes. There is no encoding translation at the core level.
277
278 · The commit log messages are uninterpreted sequence of non-NUL
279 bytes.
280 Although we encourage that the commit log messages are encoded in
281 UTF-8, both the core and git Porcelain are designed not to force UTF-8
282 on projects. If all participants of a particular project find it more
283 convenient to use legacy encodings, git does not forbid it. However,
284 there are a few things to keep in mind.
285
286
287 1. git-commit-tree (hence, git-commit which uses it) issues an
288 warning if the commit log message given to it does not look like a
289 valid UTF-8 string, unless you explicitly say your project uses a
290 legacy encoding. The way to say this is to have i18n.commitencoding
291 in .git/config file, like this:
292
293
294
295 [i18n]
296 commitencoding = ISO-8859-1
297
298 Commit objects created with the above setting record the value of
299 i18n.commitencoding in its encoding header. This is to help other
300 people who look at them later. Lack of this header implies that the
301 commit log message is encoded in UTF-8.
302
303 2. git-log, git-show and friends looks at the encoding header of a
304 commit object, and tries to re-code the log message into UTF-8
305 unless otherwise specified. You can specify the desired output
306 encoding with i18n.logoutputencoding in .git/config file, like
307 this:
308
309
310
311 [i18n]
312 logoutputencoding = ISO-8859-1
313
314 If you do not have this configuration variable, the value of
315 i18n.commitencoding is used instead.
316 Note that we deliberately chose not to re-code the commit log message
317 when a commit is made to force UTF-8 at the commit object level,
318 because re-coding to UTF-8 is not necessarily a reversible operation.
319
321 Written by Linus Torvalds <torvalds@osdl.org>
322
324 Documentation by David Greaves, Junio C Hamano and the git-list
325 <git@vger.kernel.org>.
326
328 Part of the git(7) suite
329
330
331
332
333Git 1.5.3.3 10/09/2007 GIT-LOG(1)