1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8" />
6 <meta name=
"generator" content=
"AsciiDoc 8.2.5" />
7 <style type=
"text/css">
9 p
, li
, dt
, dd
, div
, pre
, h1
, h2
, h3
, h4
, h5
, h6
{
11 border: 1px solid red;
16 margin: 1em 5% 1em 5%;
21 text-decoration: underline
;
39 h1
, h2
, h3
, h4
, h5
, h6
{
41 font-family: sans-serif
;
48 border-bottom: 2px solid silver
;
66 border: 1px solid silver
;
81 font-family: sans-serif
;
88 font-family: sans-serif
;
92 font-family: sans-serif
;
94 border-top: 2px solid silver
;
100 padding-bottom: 0.5em;
104 padding-bottom: 0.5em;
108 div
.tableblock
, div
.imageblock
, div
.exampleblock
, div
.verseblock
,
109 div
.quoteblock
, div
.literalblock
, div
.listingblock
, div
.sidebarblock
,
110 div
.admonitionblock
{
113 margin-bottom: 1.5em;
115 div
.admonitionblock
{
117 margin-bottom: 2.5em;
120 div
.content
{ /* Block element content. */
124 /* Block element titles. */
125 div
.title
, caption
.title
{
126 font-family: sans-serif
;
130 margin-bottom: 0.5em;
136 td div
.title:first-child
{
139 div
.content div
.title:first-child
{
142 div
.content
+ div
.title
{
146 div
.sidebarblock
> div
.content
{
148 border: 1px solid silver
;
155 div
.listingblock
> div
.content
{
156 border: 1px solid silver
;
161 div
.quoteblock
> div
.content
{
168 div
.verseblock
+ div
.attribution
{
172 div
.admonitionblock
.icon
{
176 text-decoration: underline
;
178 padding-right: 0.5em;
180 div
.admonitionblock td
.content
{
182 border-left: 2px solid silver
;
185 div
.exampleblock
> div
.content
{
186 border-left: 2px solid silver
;
190 div
.verseblock div
.content
{
194 div
.imageblock div
.content
{ padding-left: 0; }
195 div
.imageblock img
{ border: 1px solid silver
; }
196 span
.image img
{ border-style: none
; }
200 margin-bottom: 0.8em;
212 list-style-position: outside
;
215 list-style-type: lower-alpha
;
218 div
.tableblock
> table
{
219 border: 3px solid
#527bbd;
222 font-family: sans-serif
;
231 margin-bottom: 0.8em;
239 padding-right: 0.8em;
246 div#footer-badges
{ display: none
; }
251 font-family: sans-serif
;
255 margin-bottom: 0.1em;
258 div
.toclevel1
, div
.toclevel2
, div
.toclevel3
, div
.toclevel4
{
274 include1::./stylesheets
/xhtml11-manpage
.css
[]
275 /* Workarounds for IE6's broken and incomplete CSS2. */
277 div
.sidebar-content
{
279 border: 1px solid silver
;
282 div
.sidebar-title
, div
.image-title
{
283 font-family: sans-serif
;
286 margin-bottom: 0.5em;
289 div
.listingblock div
.content
{
290 border: 1px solid silver
;
295 div
.quoteblock-content
{
299 div
.exampleblock-content
{
300 border-left: 2px solid silver
;
304 /* IE6 sets dynamically generated links as visited. */
305 div#toc
a:visited
{ color: blue
; }
307 <title>git-log(
1)
</title>
312 git-log(
1) Manual Page
315 <div class=
"sectionbody">
322 <div class=
"sectionbody">
323 <div class=
"para"><p><em>git log
</em> [
<options
>] [
<since
>..
<until
>] [[--]
<path
>…]
</p></div>
325 <h2 id=
"_description">DESCRIPTION
</h2>
326 <div class=
"sectionbody">
327 <div class=
"para"><p>Shows the commit logs.
</p></div>
328 <div class=
"para"><p>The command takes options applicable to the
<em>git rev-list
</em>
329 command to control what is shown and how, and options applicable to
330 the
<em>git diff-*
</em> commands to control how the changes
331 each commit introduces are shown.
</p></div>
333 <h2 id=
"_options">OPTIONS
</h2>
334 <div class=
"sectionbody">
335 <div class=
"vlist"><dl>
344 Generate patch (see section on generating patches).
356 Generate diffs with
<n
> lines of context instead of
366 Generate the raw format.
375 Synonym for
<tt>-p --raw
</tt>.
383 Generate a diff using the
"patience diff" algorithm.
387 --stat[=width[,name-width]]
391 Generate a diffstat. You can override the default
392 output width for
80-column terminal by
<tt>--stat=width
</tt>.
393 The width of the filename part can be controlled by
394 giving another width to it separated by a comma.
402 Similar to
<tt>--stat
</tt>, but shows number of added and
403 deleted lines in decimal notation and pathname without
404 abbreviation, to make it more machine friendly. For
405 binary files, outputs two
<tt>-
</tt> instead of saying
414 Output only the last line of the
<tt>--stat
</tt> format containing total
415 number of modified files, as well as number of added and deleted
424 Output the distribution of relative amount of changes (number of lines added or
425 removed) for each sub-directory. Directories with changes below
426 a cut-off percent (
3% by default) are not shown. The cut-off percent
427 can be set with
<tt>--dirstat=limit
</tt>. Changes in a child directory is not
428 counted for the parent directory, unless
<tt>--cumulative
</tt> is used.
432 --dirstat-by-file[=limit]
436 Same as
<tt>--dirstat
</tt>, but counts changed files instead of lines.
444 Output a condensed summary of extended header information
445 such as creations, renames and mode changes.
453 Synonym for
<tt>-p --stat
</tt>.
461 Separate the commits with NULs instead of with new newlines.
463 <div class=
"para"><p>Also, when
<tt>--raw
</tt> or
<tt>--numstat
</tt> has been given, do not munge
464 pathnames and use NULs as output field terminators.
</p></div>
465 <div class=
"para"><p>Without this option, each pathname output will have TAB, LF, double quotes,
466 and backslash characters replaced with
<tt>\t
</tt>,
<tt>\n
</tt>,
<tt>\
"</tt>, and <tt>\\</tt>,
467 respectively, and the pathname will be enclosed in double quotes if
468 any of those replacements occurred.</p></div>
475 Show only names of changed files.
483 Show only names and status of changed files. See the description
484 of the <tt>--diff-filter</tt> option on what the status letters mean.
488 --submodule[=<format>]
492 Chose the output format for submodule differences. <format> can be one of
493 <em>short</em> and <em>log</em>. <em>short</em> just shows pairs of commit names, this format
494 is used when this option is not given. <em>log</em> is the default value for this
495 option and lists the commits in that commit range like the <em>summary</em>
496 option of <a href="git-submodule.html
">git-submodule(1)</a> does.
512 Turn off colored diff, even when the configuration file
513 gives the default to color output.
517 --color-words[=<regex>]
521 Show colored word diff, i.e., color words which have changed.
522 By default, words are separated by whitespace.
524 <div class="para
"><p>When a <regex> is specified, every non-overlapping match of the
525 <regex> is considered a word. Anything between these matches is
526 considered whitespace and ignored(!) for the purposes of finding
527 differences. You may want to append <tt>|[^[:space:]]</tt> to your regular
528 expression to make sure that it matches all non-whitespace characters.
529 A match that contains a newline is silently truncated(!) at the
531 <div class="para
"><p>The regex can also be set via a diff driver or configuration option, see
532 <a href="gitattributes.html
">gitattributes(1)</a> or <a href="git-config.html
">git-config(1)</a>. Giving it explicitly
533 overrides any diff driver or configuration setting. Diff drivers
534 override configuration settings.</p></div>
541 Turn off rename detection, even when the configuration
542 file gives the default to do so.
550 Warn if changes introduce trailing whitespace
551 or an indent that uses a space before a tab. Exits with
552 non-zero status if problems are found. Not compatible with
561 Instead of the first handful of characters, show the full
562 pre- and post-image blob object names on the "index
"
563 line when generating patch format output.
571 In addition to <tt>--full-index</tt>, output a binary diff that
572 can be applied with <tt>git-apply</tt>.
580 Instead of showing the full 40-byte hexadecimal object
581 name in diff-raw format output and diff-tree header
582 lines, show only a partial prefix. This is
583 independent of the <tt>--full-index</tt> option above, which controls
584 the diff-patch output format. Non default number of
585 digits can be specified with <tt>--abbrev=<n></tt>.
593 Break complete rewrite changes into pairs of delete and create.
609 Detect copies as well as renames. See also <tt>--find-copies-harder</tt>.
613 --diff-filter=[ACDMRTUXB*]
617 Select only files that are Added (<tt>A</tt>), Copied (<tt>C</tt>),
618 Deleted (<tt>D</tt>), Modified (<tt>M</tt>), Renamed (<tt>R</tt>), have their
619 type (i.e. regular file, symlink, submodule, …) changed (<tt>T</tt>),
620 are Unmerged (<tt>U</tt>), are
621 Unknown (<tt>X</tt>), or have had their pairing Broken (<tt>B</tt>).
622 Any combination of the filter characters may be used.
623 When <tt>*</tt> (All-or-none) is added to the combination, all
624 paths are selected if there is any file that matches
625 other criteria in the comparison; if there is no file
626 that matches other criteria, nothing is selected.
634 For performance reasons, by default, <tt>-C</tt> option finds copies only
635 if the original file of the copy was modified in the same
636 changeset. This flag makes the command
637 inspect unmodified files as candidates for the source of
638 copy. This is a very expensive operation for large
639 projects, so use it with caution. Giving more than one
640 <tt>-C</tt> option has the same effect.
648 The <tt>-M</tt> and <tt>-C</tt> options require O(n^2) processing time where n
649 is the number of potential rename/copy targets. This
650 option prevents rename/copy detection from running if
651 the number of rename/copy targets exceeds the specified
660 Look for differences that introduce or remove an instance of
661 <string>. Note that this is different than the string simply
662 appearing in diff output; see the <em>pickaxe</em> entry in
663 <a href="gitdiffcore.html
">gitdiffcore(7)</a> for more details.
671 When <tt>-S</tt> finds a change, show all the changes in that
672 changeset, not just the files that contain the change
681 Make the <string> not a plain string but an extended POSIX
690 Output the patch in the order specified in the
691 <orderfile>, which has one shell glob pattern per line.
699 Swap two inputs; that is, show differences from index or
700 on-disk file to tree contents.
704 --relative[=<path>]
708 When run from a subdirectory of the project, it can be
709 told to exclude changes outside the directory and show
710 pathnames relative to it with this option. When you are
711 not in a subdirectory (e.g. in a bare repository), you
712 can name which subdirectory to make the output relative
713 to by giving a <path> as an argument.
724 Treat all files as text.
728 --ignore-space-at-eol
732 Ignore changes in whitespace at EOL.
739 --ignore-space-change
743 Ignore changes in amount of whitespace. This ignores whitespace
744 at line end, and considers all other sequences of one or
745 more whitespace characters to be equivalent.
756 Ignore whitespace when comparing lines. This ignores
757 differences even if one line has whitespace where the other
762 --inter-hunk-context=<lines>
766 Show the context between diff hunks, up to the specified number
767 of lines, thereby fusing hunks that are close to each other.
775 Make the program exit with codes similar to diff(1).
776 That is, it exits with 1 if there were differences and
777 0 means no differences.
785 Disable all output of the program. Implies <tt>--exit-code</tt>.
793 Allow an external diff helper to be executed. If you set an
794 external diff driver with <a href="gitattributes.html
">gitattributes(5)</a>, you need
795 to use this option with <a href="git-log.html
">git-log(1)</a> and friends.
803 Disallow external diff drivers.
811 Ignore changes to submodules in the diff generation.
815 --src-prefix=<prefix>
819 Show the given source prefix instead of "a/
".
823 --dst-prefix=<prefix>
827 Show the given destination prefix instead of "b/
".
835 Do not show any source or destination prefix.
839 <div class="para
"><p>For more detailed explanation on these common options, see also
840 <a href="gitdiffcore.html
">gitdiffcore(7)</a>.</p></div>
841 <div class="vlist
"><dl>
847 Limits the number of commits to show.
851 <since>..<until>
855 Show only commits between the named two commits. When
856 either <since> or <until> is omitted, it defaults to
857 <tt>HEAD</tt>, i.e. the tip of the current branch.
858 For a more complete list of ways to spell <since>
859 and <until>, see "SPECIFYING REVISIONS
" section in
860 <a href="git-rev-parse.html
">git-rev-parse(1)</a>.
864 --decorate[=short|full]
868 Print out the ref names of any commits that are shown. If <em>short</em> is
869 specified, the ref name prefixes <em>refs/heads/</em>, <em>refs/tags/</em> and
870 <em>refs/remotes/</em> will not be printed. If <em>full</em> is specified, the
871 full ref name (including prefix) will be printed. The default option
880 Print out the ref name given on the command line by which each
889 Without this flag, "git log -p
<path
>…" shows commits that
890 touch the specified paths, and diffs about the same specified
891 paths. With this, the full diff is shown for commits that touch
892 the specified paths; this means that "<path
>…" limits only
893 commits, and doesn't limit diff for those commits.
901 Continue listing the history of a file beyond renames.
909 Before the log message print out its size in bytes. Intended
910 mainly for porcelain tools consumption. If git is unable to
911 produce a valid value size is set to zero.
912 Note that only message is considered, if also a diff is shown
913 its size is not included.
917 [--] <path>…
921 Show only commits that affect any of the specified paths. To
922 prevent confusion with options and branch names, paths may need
923 to be prefixed with "--
" to separate them from options or
928 <h3 id="_commit_formatting
">Commit Formatting</h3><div style="clear:left
"></div>
929 <div class="vlist
"><dl>
931 --pretty[=<em><format></em>]
934 --format[=<em><format></em>]
938 Pretty-print the contents of the commit logs in a given format,
939 where <em><format></em> can be one of <em>oneline</em>, <em>short</em>, <em>medium</em>,
940 <em>full</em>, <em>fuller</em>, <em>email</em>, <em>raw</em> and <em>format:<string></em>.
941 When omitted, the format defaults to <em>medium</em>.
943 <div class="para
"><p>Note: you can specify the default pretty format in the repository
944 configuration (see <a href="git-config.html
">git-config(1)</a>).</p></div>
951 Instead of showing the full 40-byte hexadecimal commit object
952 name, show only a partial prefix. Non default number of
953 digits can be specified with "--abbrev=
<n
>" (which also modifies
954 diff output, if it is displayed).
956 <div class="para
"><p>This should make "--pretty=oneline
" a whole lot more readable for
957 people using 80-column terminals.</p></div>
964 This is a shorthand for "--pretty=oneline --abbrev-commit
"
969 --encoding[=<encoding>]
973 The commit objects record the encoding used for the log message
974 in their encoding header; this option can be used to tell the
975 command to re-code the commit log message in the encoding
976 preferred by the user. For non plumbing commands this
985 Synonym for <tt>--date=relative</tt>.
989 --date={relative,local,default,iso,rfc,short,raw}
993 Only takes effect for dates shown in human-readable format, such
994 as when using "--pretty
". <tt>log.date</tt> config variable sets a default
995 value for log command's --date option.
997 <div class="para
"><p><tt>--date=relative</tt> shows dates relative to the current time,
998 e.g. "2 hours ago
".</p></div>
999 <div class="para
"><p><tt>--date=local</tt> shows timestamps in user's local timezone.</p></div>
1000 <div class="para
"><p><tt>--date=iso</tt> (or <tt>--date=iso8601</tt>) shows timestamps in ISO 8601 format.</p></div>
1001 <div class="para
"><p><tt>--date=rfc</tt> (or <tt>--date=rfc2822</tt>) shows timestamps in RFC 2822
1002 format, often found in E-mail messages.</p></div>
1003 <div class="para
"><p><tt>--date=short</tt> shows only date but not time, in <tt>YYYY-MM-DD</tt> format.</p></div>
1004 <div class="para
"><p><tt>--date=raw</tt> shows the date in the internal raw git format <tt>%s %z</tt> format.</p></div>
1005 <div class="para
"><p><tt>--date=default</tt> shows timestamps in the original timezone
1006 (either committer's or author's).</p></div>
1013 Print the parents of the commit. Also enables parent
1014 rewriting, see <em>History Simplification</em> below.
1022 Print the children of the commit. Also enables parent
1023 rewriting, see <em>History Simplification</em> below.
1031 Mark which side of a symmetric diff a commit is reachable from.
1032 Commits from the left side are prefixed with <tt><</tt> and those from
1033 the right with <tt>></tt>. If combined with <tt>--boundary</tt>, those
1034 commits are prefixed with <tt>-</tt>.
1036 <div class="para
"><p>For example, if you have this topology:</p></div>
1037 <div class="listingblock
">
1038 <div class="content
">
1039 <pre><tt> y---b---b branch B
1043 o---x---a---a branch A</tt></pre>
1045 <div class="para
"><p>you would get an output like this:</p></div>
1046 <div class="listingblock
">
1047 <div class="content
">
1048 <pre><tt> $ git rev-list --left-right --boundary --pretty=oneline A...B
1050 >bbbbbbb... 3rd on b
1051 >bbbbbbb... 2nd on b
1052 <aaaaaaa... 3rd on a
1053 <aaaaaaa... 2nd on a
1054 -yyyyyyy... 1st on b
1055 -xxxxxxx... 1st on a</tt></pre>
1063 Draw a text-based graphical representation of the commit history
1064 on the left hand side of the output. This may cause extra lines
1065 to be printed in between commits, in order for the graph history
1066 to be drawn properly.
1068 <div class="para
"><p>This implies the <em>--topo-order</em> option by default, but the
1069 <em>--date-order</em> option may also be specified.</p></div>
1072 <h3 id="_diff_formatting
">Diff Formatting</h3><div style="clear:left
"></div>
1073 <div class="para
"><p>Below are listed options that control the formatting of diff output.
1074 Some of them are specific to <a href="git-rev-list.html
">git-rev-list(1)</a>, however other diff
1075 options may be given. See <a href="git-diff-files.html
">git-diff-files(1)</a> for more options.</p></div>
1076 <div class="vlist
"><dl>
1082 This flag changes the way a merge commit is displayed. It shows
1083 the differences from each of the parents to the merge result
1084 simultaneously instead of showing pairwise diff between a parent
1085 and the result one at a time. Furthermore, it lists only files
1086 which were modified from all parents.
1094 This flag implies the <em>-c</em> options and further compresses the
1095 patch output by omitting uninteresting hunks whose contents in
1096 the parents have only two variants and the merge result picks
1097 one of them without modification.
1105 Show recursive diffs.
1113 Show the tree objects in the diff output. This implies <em>-r</em>.
1117 <h3 id="_commit_limiting
">Commit Limiting</h3><div style="clear:left
"></div>
1118 <div class="para
"><p>Besides specifying a range of commits that should be listed using the
1119 special notations explained in the description, additional commit
1120 limiting may be applied.</p></div>
1121 <div class="vlist
"><dl>
1126 --max-count=<number>
1130 Limit the number of commits output.
1134 --skip=<number>
1138 Skip <em>number</em> commits before starting to show the commit output.
1142 --since=<date>
1145 --after=<date>
1149 Show commits more recent than a specific date.
1153 --until=<date>
1156 --before=<date>
1160 Show commits older than a specific date.
1164 --author=<pattern>
1167 --committer=<pattern>
1171 Limit the commits output to ones with author/committer
1172 header lines that match the specified pattern (regular expression).
1176 --grep=<pattern>
1180 Limit the commits output to ones with log message that
1181 matches the specified pattern (regular expression).
1189 Limit the commits output to ones that match all given --grep,
1190 --author and --committer instead of ones that match at least one.
1197 --regexp-ignore-case
1201 Match the regexp limiting patterns without regard to letters case.
1212 Consider the limiting patterns to be extended regular expressions
1213 instead of the default basic regular expressions.
1224 Consider the limiting patterns to be fixed strings (don't interpret
1225 pattern as a regular expression).
1233 Stop when a given path disappears from the tree.
1241 Print only merge commits.
1249 Do not print commits with more than one parent.
1257 Follow only the first parent commit upon seeing a merge
1258 commit. This option can give a better overview when
1259 viewing the evolution of a particular topic branch,
1260 because merges into a topic branch tend to be only about
1261 adjusting to updated upstream from time to time, and
1262 this option allows you to ignore the individual commits
1263 brought in to your history by such a merge.
1271 Reverses the meaning of the <em>^</em> prefix (or lack thereof)
1272 for all following revision specifiers, up to the next <em>--not</em>.
1280 Pretend as if all the refs in <tt>$GIT_DIR/refs/</tt> are listed on the
1281 command line as <em><commit></em>.
1289 Pretend as if all the refs in <tt>$GIT_DIR/refs/heads</tt> are listed
1290 on the command line as <em><commit></em>.
1298 Pretend as if all the refs in <tt>$GIT_DIR/refs/tags</tt> are listed
1299 on the command line as <em><commit></em>.
1307 Pretend as if all the refs in <tt>$GIT_DIR/refs/remotes</tt> are listed
1308 on the command line as <em><commit></em>.
1316 Pretend as if the bad bisection ref <tt>$GIT_DIR/refs/bisect/bad</tt>
1317 was listed and as if it was followed by <tt>--not</tt> and the good
1318 bisection refs <tt>$GIT_DIR/refs/bisect/good-*</tt> on the command
1327 In addition to the <em><commit></em> listed on the command
1328 line, read them from the standard input. If a <em>--</em> separator is
1329 seen, stop reading commits and start reading paths to limit the
1338 Omit any commit that introduces the same change as
1339 another commit on the "other side
" when the set of
1340 commits are limited with symmetric difference.<br />
1341 For example, if you have two branches, <tt>A</tt> and <tt>B</tt>, a usual way
1342 to list all commits on only one side of them is with
1343 <tt>--left-right</tt>, like the example above in the description of
1344 that option. It however shows the commits that were cherry-picked
1345 from the other branch (for example, "3rd on b
" may be cherry-picked
1346 from branch A). With this option, such pairs of commits are
1347 excluded from the output.
1358 Instead of walking the commit ancestry chain, walk
1359 reflog entries from the most recent one to older ones.
1360 When this option is used you cannot specify commits to
1361 exclude (that is, <em>^commit</em>, <em>commit1..commit2</em>,
1362 nor <em>commit1…commit2</em> notations cannot be used).<br />
1363 With <em>--pretty</em> format other than oneline (for obvious reasons),
1364 this causes the output to have two extra lines of information
1365 taken from the reflog. By default, <em>commit@{Nth}</em> notation is
1366 used in the output. When the starting commit is specified as
1367 <em>commit@{now}</em>, output also uses <em>commit@{timestamp}</em> notation
1368 instead. Under <em>--pretty=oneline</em>, the commit message is
1369 prefixed with this information on the same line.
1370 This option cannot be combined with <em>--reverse</em>.
1371 See also <a href="git-reflog.html
">git-reflog(1)</a>.
1379 After a failed merge, show refs that touch files having a
1380 conflict and don't exist on all heads to merge.
1388 Output uninteresting commits at the boundary, which are usually
1393 <h3 id="_history_simplification
">History Simplification</h3><div style="clear:left
"></div>
1394 <div class="para
"><p>Sometimes you are only interested in parts of the history, for example the
1395 commits modifying a particular <path>. But there are two parts of
1396 <em>History Simplification</em>, one part is selecting the commits and the other
1397 is how to do it, as there are various strategies to simplify the history.</p></div>
1398 <div class="para
"><p>The following options select the commits to be shown:</p></div>
1399 <div class="vlist
"><dl>
1405 Commits modifying the given <paths> are selected.
1409 --simplify-by-decoration
1413 Commits that are referred by some branch or tag are selected.
1417 <div class="para
"><p>Note that extra commits can be shown to give a meaningful history.</p></div>
1418 <div class="para
"><p>The following options affect the way the simplification is performed:</p></div>
1419 <div class="vlist
"><dl>
1425 Simplifies the history to the simplest history explaining the
1426 final state of the tree. Simplest because it prunes some side
1427 branches if the end result is the same (i.e. merging branches
1428 with the same content)
1436 As the default mode but does not prune some history.
1444 Only the selected commits are shown, plus some to have a
1453 All commits in the simplified history are shown.
1461 Additional option to <em>--full-history</em> to remove some needless
1462 merges from the resulting history, as there are no selected
1463 commits contributing to this merge.
1467 <div class="para
"><p>A more detailed explanation follows.</p></div>
1468 <div class="para
"><p>Suppose you specified <tt>foo</tt> as the <paths>. We shall call commits
1469 that modify <tt>foo</tt> !TREESAME, and the rest TREESAME. (In a diff
1470 filtered for <tt>foo</tt>, they look different and equal, respectively.)</p></div>
1471 <div class="para
"><p>In the following, we will always refer to the same example history to
1472 illustrate the differences between simplification settings. We assume
1473 that you are filtering for a file <tt>foo</tt> in this commit graph:</p></div>
1474 <div class="listingblock
">
1475 <div class="content
">
1476 <pre><tt> .-A---M---N---O---P
1480 `-------------'</tt></pre>
1482 <div class="para
"><p>The horizontal line of history A--P is taken to be the first parent of
1483 each merge. The commits are:</p></div>
1484 <div class="ilist
"><ul>
1487 <tt>I</tt> is the initial commit, in which <tt>foo</tt> exists with contents
1488 "asdf
", and a file <tt>quux</tt> exists with contents "quux
". Initial
1489 commits are compared to an empty tree, so <tt>I</tt> is !TREESAME.
1494 In <tt>A</tt>, <tt>foo</tt> contains just "foo
".
1499 <tt>B</tt> contains the same change as <tt>A</tt>. Its merge <tt>M</tt> is trivial and
1500 hence TREESAME to all parents.
1505 <tt>C</tt> does not change <tt>foo</tt>, but its merge <tt>N</tt> changes it to "foobar
",
1506 so it is not TREESAME to any parent.
1511 <tt>D</tt> sets <tt>foo</tt> to "baz
". Its merge <tt>O</tt> combines the strings from
1512 <tt>N</tt> and <tt>D</tt> to "foobarbaz
"; i.e., it is not TREESAME to any parent.
1517 <tt>E</tt> changes <tt>quux</tt> to "xyzzy
", and its merge <tt>P</tt> combines the
1518 strings to "quux xyzzy
". Despite appearing interesting, <tt>P</tt> is
1519 TREESAME to all parents.
1523 <div class="para
"><p><em>rev-list</em> walks backwards through history, including or excluding
1524 commits based on whether <em>--full-history</em> and/or parent rewriting
1525 (via <em>--parents</em> or <em>--children</em>) are used. The following settings
1526 are available.</p></div>
1527 <div class="vlist
"><dl>
1533 Commits are included if they are not TREESAME to any parent
1534 (though this can be changed, see <em>--sparse</em> below). If the
1535 commit was a merge, and it was TREESAME to one parent, follow
1536 only that parent. (Even if there are several TREESAME
1537 parents, follow only one of them.) Otherwise, follow all
1540 <div class="para
"><p>This results in:</p></div>
1541 <div class="listingblock
">
1542 <div class="content
">
1543 <pre><tt> .-A---N---O
1545 I---------D</tt></pre>
1547 <div class="para
"><p>Note how the rule to only follow the TREESAME parent, if one is
1548 available, removed <tt>B</tt> from consideration entirely. <tt>C</tt> was
1549 considered via <tt>N</tt>, but is TREESAME. Root commits are compared to an
1550 empty tree, so <tt>I</tt> is !TREESAME.</p></div>
1551 <div class="para
"><p>Parent/child relations are only visible with --parents, but that does
1552 not affect the commits selected in default mode, so we have shown the
1553 parent lines.</p></div>
1556 --full-history without parent rewriting
1560 This mode differs from the default in one point: always follow
1561 all parents of a merge, even if it is TREESAME to one of them.
1562 Even if more than one side of the merge has commits that are
1563 included, this does not imply that the merge itself is! In
1566 <div class="listingblock
">
1567 <div class="content
">
1568 <pre><tt> I A B N D O</tt></pre>
1570 <div class="para
"><p><tt>P</tt> and <tt>M</tt> were excluded because they are TREESAME to a parent. <tt>E</tt>,
1571 <tt>C</tt> and <tt>B</tt> were all walked, but only <tt>B</tt> was !TREESAME, so the others
1572 do not appear.</p></div>
1573 <div class="para
"><p>Note that without parent rewriting, it is not really possible to talk
1574 about the parent/child relationships between the commits, so we show
1575 them disconnected.</p></div>
1578 --full-history with parent rewriting
1582 Ordinary commits are only included if they are !TREESAME
1583 (though this can be changed, see <em>--sparse</em> below).
1585 <div class="para
"><p>Merges are always included. However, their parent list is rewritten:
1586 Along each parent, prune away commits that are not included
1587 themselves. This results in</p></div>
1588 <div class="listingblock
">
1589 <div class="content
">
1590 <pre><tt> .-A---M---N---O---P
1594 `-------------'</tt></pre>
1596 <div class="para
"><p>Compare to <em>--full-history</em> without rewriting above. Note that <tt>E</tt>
1597 was pruned away because it is TREESAME, but the parent list of P was
1598 rewritten to contain <tt>E</tt>'s parent <tt>I</tt>. The same happened for <tt>C</tt> and
1599 <tt>N</tt>. Note also that <tt>P</tt> was included despite being TREESAME.</p></div>
1602 <div class="para
"><p>In addition to the above settings, you can change whether TREESAME
1603 affects inclusion:</p></div>
1604 <div class="vlist
"><dl>
1610 Commits that are walked are included if they are not TREESAME
1619 All commits that are walked are included.
1621 <div class="para
"><p>Note that without <em>--full-history</em>, this still simplifies merges: if
1622 one of the parents is TREESAME, we follow only that one, so the other
1623 sides of the merge are never walked.</p></div>
1626 <div class="para
"><p>Finally, there is a fourth simplification mode available:</p></div>
1627 <div class="vlist
"><dl>
1633 First, build a history graph in the same way that
1634 <em>--full-history</em> with parent rewriting does (see above).
1636 <div class="para
"><p>Then simplify each commit <tt>C</tt> to its replacement <tt>C'</tt> in the final
1637 history according to the following rules:</p></div>
1638 <div class="ilist
"><ul>
1641 Set <tt>C'</tt> to <tt>C</tt>.<br />
1646 Replace each parent <tt>P</tt> of <tt>C'</tt> with its simplification <tt>P'</tt>. In
1647 the process, drop parents that are ancestors of other parents, and
1648 remove duplicates.<br />
1653 If after this parent rewriting, <tt>C'</tt> is a root or merge commit (has
1654 zero or >1 parents), a boundary commit, or !TREESAME, it remains.
1655 Otherwise, it is replaced with its only parent.
1659 <div class="para
"><p>The effect of this is best shown by way of comparing to
1660 <em>--full-history</em> with parent rewriting. The example turns into:</p></div>
1661 <div class="listingblock
">
1662 <div class="content
">
1663 <pre><tt> .-A---M---N---O
1667 `---------'</tt></pre>
1669 <div class="para
"><p>Note the major differences in <tt>N</tt> and <tt>P</tt> over <em>--full-history</em>:</p></div>
1670 <div class="ilist
"><ul>
1673 <tt>N</tt>'s parent list had <tt>I</tt> removed, because it is an ancestor of the
1674 other parent <tt>M</tt>. Still, <tt>N</tt> remained because it is !TREESAME.<br />
1679 <tt>P</tt>'s parent list similarly had <tt>I</tt> removed. <tt>P</tt> was then
1680 removed completely, because it had one parent and is TREESAME.
1686 <div class="para
"><p>The <em>--simplify-by-decoration</em> option allows you to view only the
1687 big picture of the topology of the history, by omitting commits
1688 that are not referenced by tags. Commits are marked as !TREESAME
1689 (in other words, kept after history simplification rules described
1690 above) if (1) they are referenced by tags, or (2) they change the
1691 contents of the paths given on the command line. All other
1692 commits are marked as TREESAME (subject to be simplified away).</p></div>
1693 <h3 id="_commit_ordering
">Commit Ordering</h3><div style="clear:left
"></div>
1694 <div class="para
"><p>By default, the commits are shown in reverse chronological order.</p></div>
1695 <div class="vlist
"><dl>
1701 This option makes them appear in topological order (i.e.
1702 descendant commits are shown before their parents).
1710 This option is similar to <em>--topo-order</em> in the sense that no
1711 parent comes before all of its children, but otherwise things
1712 are still ordered in the commit timestamp order.
1720 Output the commits in reverse order.
1721 Cannot be combined with <em>--walk-reflogs</em>.
1725 <h3 id="_object_traversal
">Object Traversal</h3><div style="clear:left
"></div>
1726 <div class="para
"><p>These options are mostly targeted for packing of git repositories.</p></div>
1727 <div class="vlist
"><dl>
1733 Print the object IDs of any object referenced by the listed
1734 commits. <em>--objects foo ^bar</em> thus means "send me
1735 all object IDs which I need to download if I have the commit
1736 object
<em>bar
</em>, but not
<em>foo
</em>".
1744 Similar to <em>--objects</em>, but also print the IDs of excluded
1745 commits prefixed with a "-
" character. This is used by
1746 <a href="git-pack-objects.html
">git-pack-objects(1)</a> to build "thin
" pack, which records
1747 objects in deltified form based on objects contained in these
1748 excluded commits to reduce network traffic.
1756 Only useful with <em>--objects</em>; print the object IDs that are not
1765 Only show the given revs, but do not traverse their ancestors.
1773 Overrides a previous --no-walk.
1778 <h2 id="_pretty_formats
">PRETTY FORMATS</h2>
1779 <div class="sectionbody
">
1780 <div class="para
"><p>If the commit is a merge, and if the pretty-format
1781 is not <em>oneline</em>, <em>email</em> or <em>raw</em>, an additional line is
1782 inserted before the <em>Author:</em> line. This line begins with
1783 "Merge:
" and the sha1s of ancestral commits are printed,
1784 separated by spaces. Note that the listed commits may not
1785 necessarily be the list of the <strong>direct</strong> parent commits if you
1786 have limited your view of history: for example, if you are
1787 only interested in changes related to a certain directory or
1789 <div class="para
"><p>Here are some additional details for each format:</p></div>
1790 <div class="ilist
"><ul>
1795 <div class="literalblock
">
1796 <div class="content
">
1797 <pre><tt><sha1> <title line></tt></pre>
1799 <div class="para
"><p>This is designed to be as compact as possible.</p></div>
1805 <div class="literalblock
">
1806 <div class="content
">
1807 <pre><tt>commit <sha1>
1808 Author: <author></tt></pre>
1810 <div class="literalblock
">
1811 <div class="content
">
1812 <pre><tt><title line></tt></pre>
1819 <div class="literalblock
">
1820 <div class="content
">
1821 <pre><tt>commit <sha1>
1822 Author: <author>
1823 Date: <author date></tt></pre>
1825 <div class="literalblock
">
1826 <div class="content
">
1827 <pre><tt><title line></tt></pre>
1829 <div class="literalblock
">
1830 <div class="content
">
1831 <pre><tt><full commit message></tt></pre>
1838 <div class="literalblock
">
1839 <div class="content
">
1840 <pre><tt>commit <sha1>
1841 Author: <author>
1842 Commit: <committer></tt></pre>
1844 <div class="literalblock
">
1845 <div class="content
">
1846 <pre><tt><title line></tt></pre>
1848 <div class="literalblock
">
1849 <div class="content
">
1850 <pre><tt><full commit message></tt></pre>
1857 <div class="literalblock
">
1858 <div class="content
">
1859 <pre><tt>commit <sha1>
1860 Author: <author>
1861 AuthorDate: <author date>
1862 Commit: <committer>
1863 CommitDate: <committer date></tt></pre>
1865 <div class="literalblock
">
1866 <div class="content
">
1867 <pre><tt><title line></tt></pre>
1869 <div class="literalblock
">
1870 <div class="content
">
1871 <pre><tt><full commit message></tt></pre>
1878 <div class="literalblock
">
1879 <div class="content
">
1880 <pre><tt>From <sha1> <date>
1881 From: <author>
1882 Date: <author date>
1883 Subject: [PATCH] <title line></tt></pre>
1885 <div class="literalblock
">
1886 <div class="content
">
1887 <pre><tt><full commit message></tt></pre>
1894 <div class="para
"><p>The <em>raw</em> format shows the entire commit exactly as
1895 stored in the commit object. Notably, the SHA1s are
1896 displayed in full, regardless of whether --abbrev or
1897 --no-abbrev are used, and <em>parents</em> information show the
1898 true parent commits, without taking grafts nor history
1899 simplification into account.</p></div>
1905 <div class="para
"><p>The <em>format:</em> format allows you to specify which information
1906 you want to show. It works a little bit like printf format,
1907 with the notable exception that you get a newline with <em>%n</em>
1908 instead of <em>\n</em>.</p></div>
1909 <div class="para
"><p>E.g, <em>format:"The author of %h was %an, %ar%nThe title was
>>%s
<<%n
"</em>
1910 would show something like this:</p></div>
1911 <div class="listingblock
">
1912 <div class="content
">
1913 <pre><tt>The author of fe6e0ee was Junio C Hamano, 23 hours ago
1914 The title was >>t4119: test autocomputing -p<n> for traditional diff input.<<
1917 <div class="para
"><p>The placeholders are:</p></div>
1918 <div class="ilist
"><ul>
1921 <em>%H</em>: commit hash
1926 <em>%h</em>: abbreviated commit hash
1931 <em>%T</em>: tree hash
1936 <em>%t</em>: abbreviated tree hash
1941 <em>%P</em>: parent hashes
1946 <em>%p</em>: abbreviated parent hashes
1951 <em>%an</em>: author name
1956 <em>%aN</em>: author name (respecting .mailmap, see <a href="git-shortlog.html
">git-shortlog(1)</a> or <a href="git-blame.html
">git-blame(1)</a>)
1961 <em>%ae</em>: author email
1966 <em>%aE</em>: author email (respecting .mailmap, see <a href="git-shortlog.html
">git-shortlog(1)</a> or <a href="git-blame.html
">git-blame(1)</a>)
1971 <em>%ad</em>: author date (format respects --date= option)
1976 <em>%aD</em>: author date, RFC2822 style
1981 <em>%ar</em>: author date, relative
1986 <em>%at</em>: author date, UNIX timestamp
1991 <em>%ai</em>: author date, ISO 8601 format
1996 <em>%cn</em>: committer name
2001 <em>%cN</em>: committer name (respecting .mailmap, see <a href="git-shortlog.html
">git-shortlog(1)</a> or <a href="git-blame.html
">git-blame(1)</a>)
2006 <em>%ce</em>: committer email
2011 <em>%cE</em>: committer email (respecting .mailmap, see <a href="git-shortlog.html
">git-shortlog(1)</a> or <a href="git-blame.html
">git-blame(1)</a>)
2016 <em>%cd</em>: committer date
2021 <em>%cD</em>: committer date, RFC2822 style
2026 <em>%cr</em>: committer date, relative
2031 <em>%ct</em>: committer date, UNIX timestamp
2036 <em>%ci</em>: committer date, ISO 8601 format
2041 <em>%d</em>: ref names, like the --decorate option of <a href="git-log.html
">git-log(1)</a>
2046 <em>%e</em>: encoding
2051 <em>%s</em>: subject
2056 <em>%f</em>: sanitized subject line, suitable for a filename
2066 <em>%N</em>: commit notes
2071 <em>%gD</em>: reflog selector, e.g., <tt>refs/stash@{1}</tt>
2076 <em>%gd</em>: shortened reflog selector, e.g., <tt>stash@{1}</tt>
2081 <em>%gs</em>: reflog subject
2086 <em>%Cred</em>: switch color to red
2091 <em>%Cgreen</em>: switch color to green
2096 <em>%Cblue</em>: switch color to blue
2101 <em>%Creset</em>: reset color
2106 <em>%C(…)</em>: color specification, as described in color.branch.* config option
2111 <em>%m</em>: left, right or boundary mark
2116 <em>%n</em>: newline
2121 <em>%%</em>: a raw <em>%</em>
2126 <em>%x00</em>: print a byte from a hex code
2131 <em>%w([<w>[,<i1>[,<i2>]]])</em>: switch line wrapping, like the -w option of
2132 <a href="git-shortlog.html
">git-shortlog(1)</a>.
2138 <div class="admonitionblock
">
2141 <div class="title
">Note</div>
2143 <td class="content
">Some placeholders may depend on other options given to the
2144 revision traversal engine. For example, the <tt>%g*</tt> reflog options will
2145 insert an empty string unless we are traversing reflog entries (e.g., by
2146 <tt>git log -g</tt>). The <tt>%d</tt> placeholder will use the "short
" decoration
2147 format if <tt>--decorate</tt> was not already provided on the command line.</td>
2150 <div class="para
"><p>If you add a <tt>+</tt> (plus sign) after <em>%</em> of a placeholder, a line-feed
2151 is inserted immediately before the expansion if and only if the
2152 placeholder expands to a non-empty string.</p></div>
2153 <div class="para
"><p>If you add a <tt>-</tt> (minus sign) after <em>%</em> of a placeholder, line-feeds that
2154 immediately precede the expansion are deleted if and only if the
2155 placeholder expands to an empty string.</p></div>
2156 <div class="ilist
"><ul>
2161 <div class="para
"><p>The <em>tformat:</em> format works exactly like <em>format:</em>, except that it
2162 provides "terminator
" semantics instead of "separator
" semantics. In
2163 other words, each commit has the message terminator character (usually a
2164 newline) appended, rather than a separator placed between entries.
2165 This means that the final entry of a single-line format will be properly
2166 terminated with a new line, just as the "oneline
" format does.
2167 For example:</p></div>
2168 <div class="listingblock
">
2169 <div class="content
">
2170 <pre><tt>$ git log -2 --pretty=format:%h 4da45bef \
2171 | perl -pe '$_ .= " -- NO NEWLINE\n
" unless /\n/'
2173 7134973 -- NO NEWLINE
2175 $ git log -2 --pretty=tformat:%h 4da45bef \
2176 | perl -pe '$_ .= " -- NO NEWLINE\n
" unless /\n/'
2180 <div class="para
"><p>In addition, any unrecognized string that has a <tt>%</tt> in it is interpreted
2181 as if it has <tt>tformat:</tt> in front of it. For example, these two are
2182 equivalent:</p></div>
2183 <div class="listingblock
">
2184 <div class="content
">
2185 <pre><tt>$ git log -2 --pretty=tformat:%h 4da45bef
2186 $ git log -2 --pretty=%h 4da45bef</tt></pre>
2191 <h2 id="_generating_patches_with_p
">Generating patches with -p</h2>
2192 <div class="sectionbody
">
2193 <div class="para
"><p>When "git-diff-index
", "git-diff-tree
", or "git-diff-files
" are run
2194 with a <em>-p</em> option, "git diff
" without the <em>--raw</em> option, or
2195 "git log
" with the "-p
" option, they
2196 do not produce the output described above; instead they produce a
2197 patch file. You can customize the creation of such patches via the
2198 GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</p></div>
2199 <div class="para
"><p>What the -p option produces is slightly different from the traditional
2200 diff format.</p></div>
2201 <div class="olist
"><ol>
2204 It is preceded with a "git diff
" header, that looks like
2207 <div class="literalblock
">
2208 <div class="content
">
2209 <pre><tt>diff --git a/file1 b/file2</tt></pre>
2211 <div class="para
"><p>The <tt>a/</tt> and <tt>b/</tt> filenames are the same unless rename/copy is
2212 involved. Especially, even for a creation or a deletion,
2213 <tt>/dev/null</tt> is _not_ used in place of <tt>a/</tt> or <tt>b/</tt> filenames.</p></div>
2214 <div class="para
"><p>When rename/copy is involved, <tt>file1</tt> and <tt>file2</tt> show the
2215 name of the source file of the rename/copy and the name of
2216 the file that rename/copy produces, respectively.</p></div>
2220 It is followed by one or more extended header lines:
2222 <div class="literalblock
">
2223 <div class="content
">
2224 <pre><tt>old mode <mode>
2225 new mode <mode>
2226 deleted file mode <mode>
2227 new file mode <mode>
2228 copy from <path>
2229 copy to <path>
2230 rename from <path>
2231 rename to <path>
2232 similarity index <number>
2233 dissimilarity index <number>
2234 index <hash>..<hash> <mode></tt></pre>
2239 TAB, LF, double quote and backslash characters in pathnames
2240 are represented as <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt> and
<tt>\\
</tt>, respectively.
2241 If there is need for such substitution then the whole
2242 pathname is put in double quotes.
2246 <div class=
"para"><p>The similarity index is the percentage of unchanged lines, and
2247 the dissimilarity index is the percentage of changed lines. It
2248 is a rounded down integer, followed by a percent sign. The
2249 similarity index value of
100% is thus reserved for two equal
2250 files, while
100% dissimilarity means that no line from the old
2251 file made it into the new one.
</p></div>
2253 <h2 id=
"_combined_diff_format">combined diff format
</h2>
2254 <div class=
"sectionbody">
2255 <div class=
"para"><p>"git-diff-tree",
"git-diff-files" and
"git-diff" can take
<em>-c
</em> or
2256 <em>--cc
</em> option to produce
<em>combined diff
</em>. For showing a merge commit
2257 with
"git log -p", this is the default format.
2258 A
<em>combined diff
</em> format looks like this:
</p></div>
2259 <div class=
"listingblock">
2260 <div class=
"content">
2261 <pre><tt>diff --combined describe.c
2262 index fabadb8,cc95eb0.
.4866510
2265 @@@ -
98,
20 -
98,
12 +
98,
20 @@@
2266 return (a_date
> b_date) ? -
1 : (a_date == b_date) ?
0 :
1;
2269 - static void describe(char *arg)
2270 -static void describe(struct commit *cmit, int last_one)
2271 ++static void describe(char *arg, int last_one)
2273 + unsigned char sha1[
20];
2274 + struct commit *cmit;
2275 struct commit_list *list;
2276 static int initialized =
0;
2277 struct commit_name *n;
2279 + if (get_sha1(arg, sha1)
< 0)
2280 + usage(describe_usage);
2281 + cmit = lookup_commit_reference(sha1);
2283 + usage(describe_usage);
2287 for_each_ref(get_name);
</tt></pre>
2289 <div class=
"olist"><ol>
2292 It is preceded with a
"git diff" header, that looks like
2293 this (when
<em>-c
</em> option is used):
2295 <div class=
"literalblock">
2296 <div class=
"content">
2297 <pre><tt>diff --combined file
</tt></pre>
2299 <div class=
"para"><p>or like this (when
<em>--cc
</em> option is used):
</p></div>
2300 <div class=
"literalblock">
2301 <div class=
"content">
2302 <pre><tt>diff --cc file
</tt></pre>
2307 It is followed by one or more extended header lines
2308 (this example shows a merge with two parents):
2310 <div class=
"literalblock">
2311 <div class=
"content">
2312 <pre><tt>index
<hash
>,
<hash
>..
<hash
>
2313 mode
<mode
>,
<mode
>..
<mode
>
2314 new file mode
<mode
>
2315 deleted file mode
<mode
>,
<mode
></tt></pre>
2317 <div class=
"para"><p>The
<tt>mode
<mode
>,
<mode
>..
<mode
></tt> line appears only if at least one of
2318 the
<mode
> is different from the rest. Extended headers with
2319 information about detected contents movement (renames and
2320 copying detection) are designed to work with diff of two
2321 <tree-ish
> and are not used by combined diff format.
</p></div>
2325 It is followed by two-line from-file/to-file header
2327 <div class=
"literalblock">
2328 <div class=
"content">
2330 +++ b/file
</tt></pre>
2332 <div class=
"para"><p>Similar to two-line header for traditional
<em>unified
</em> diff
2333 format,
<tt>/dev/null
</tt> is used to signal created or deleted
2338 Chunk header format is modified to prevent people from
2339 accidentally feeding it to
<tt>patch -p1
</tt>. Combined diff format
2340 was created for review of merge commit changes, and was not
2341 meant for apply. The change is similar to the change in the
2342 extended
<em>index
</em> header:
2344 <div class=
"literalblock">
2345 <div class=
"content">
2346 <pre><tt>@@@
<from-file-range
> <from-file-range
> <to-file-range
> @@@
</tt></pre>
2348 <div class=
"para"><p>There are (number of parents +
1)
<tt>@
</tt> characters in the chunk
2349 header for combined diff format.
</p></div>
2352 <div class=
"para"><p>Unlike the traditional
<em>unified
</em> diff format, which shows two
2353 files A and B with a single column that has
<tt>-
</tt> (minus
—
2354 appears in A but removed in B),
<tt>+
</tt> (plus
— missing in A but
2355 added to B), or
<tt>" "</tt> (space
— unchanged) prefix, this format
2356 compares two or more files file1, file2,
… with one file X, and
2357 shows how X differs from each of fileN. One column for each of
2358 fileN is prepended to the output line to note how X's line is
2359 different from it.
</p></div>
2360 <div class=
"para"><p>A
<tt>-
</tt> character in the column N means that the line appears in
2361 fileN but it does not appear in the result. A
<tt>+
</tt> character
2362 in the column N means that the line appears in the result,
2363 and fileN does not have that line (in other words, the line was
2364 added, from the point of view of that parent).
</p></div>
2365 <div class=
"para"><p>In the above example output, the function signature was changed
2366 from both files (hence two
<tt>-
</tt> removals from both file1 and
2367 file2, plus
<tt>++
</tt> to mean one line that was added does not appear
2368 in either file1 nor file2). Also eight other lines are the same
2369 from file1 but do not appear in file2 (hence prefixed with
<tt>+</tt>).
</p></div>
2370 <div class=
"para"><p>When shown by
<tt>git diff-tree -c
</tt>, it compares the parents of a
2371 merge commit with the merge result (i.e. file1..fileN are the
2372 parents). When shown by
<tt>git diff-files -c
</tt>, it compares the
2373 two unresolved merge parents with the working tree file
2374 (i.e. file1 is stage
2 aka
"our version", file2 is stage
3 aka
2375 "their version").
</p></div>
2377 <h2 id=
"_examples">Examples
</h2>
2378 <div class=
"sectionbody">
2379 <div class=
"vlist"><dl>
2385 Show the whole commit history, but skip any merges
2389 git log v2.6
.12.. include/scsi drivers/scsi
2393 Show all commits since version
<em>v2.6
.12</em> that changed any file
2394 in the include/scsi or drivers/scsi subdirectories
2398 git log
--since=
"2 weeks ago" -- gitk
2402 Show the changes during the last two weeks to the file
<em>gitk
</em>.
2403 The
"--" is necessary to avoid confusion with the
<strong>branch
</strong> named
2408 git log --name-status release..test
2412 Show the commits that are in the
"test" branch but not yet
2413 in the
"release" branch, along with the list of paths
2414 each commit modifies.
2418 git log --follow builtin-rev-list.c
2422 Shows the commits that changed builtin-rev-list.c, including
2423 those commits that occurred before the file was given its
2429 <h2 id=
"_discussion">Discussion
</h2>
2430 <div class=
"sectionbody">
2431 <div class=
"para"><p>At the core level, git is character encoding agnostic.
</p></div>
2432 <div class=
"ilist"><ul>
2435 The pathnames recorded in the index and in the tree objects
2436 are treated as uninterpreted sequences of non-NUL bytes.
2437 What readdir(
2) returns are what are recorded and compared
2438 with the data git keeps track of, which in turn are expected
2439 to be what lstat(
2) and creat(
2) accepts. There is no such
2440 thing as pathname encoding translation.
2445 The contents of the blob objects are uninterpreted sequences
2446 of bytes. There is no encoding translation at the core
2452 The commit log messages are uninterpreted sequences of non-NUL
2457 <div class=
"para"><p>Although we encourage that the commit log messages are encoded
2458 in UTF-
8, both the core and git Porcelain are designed not to
2459 force UTF-
8 on projects. If all participants of a particular
2460 project find it more convenient to use legacy encodings, git
2461 does not forbid it. However, there are a few things to keep in
2463 <div class=
"olist"><ol>
2466 <em>git commit
</em> and
<em>git commit-tree
</em> issues
2467 a warning if the commit log message given to it does not look
2468 like a valid UTF-
8 string, unless you explicitly say your
2469 project uses a legacy encoding. The way to say this is to
2470 have i18n.commitencoding in
<tt>.git/config
</tt> file, like this:
2472 <div class=
"listingblock">
2473 <div class=
"content">
2475 commitencoding = ISO-
8859-
1</tt></pre>
2477 <div class=
"para"><p>Commit objects created with the above setting record the value
2478 of
<tt>i18n.commitencoding
</tt> in its
<tt>encoding
</tt> header. This is to
2479 help other people who look at them later. Lack of this header
2480 implies that the commit log message is encoded in UTF-
8.
</p></div>
2484 <em>git log
</em>,
<em>git show
</em>,
<em>git blame
</em> and friends look at the
2485 <tt>encoding
</tt> header of a commit object, and try to re-code the
2486 log message into UTF-
8 unless otherwise specified. You can
2487 specify the desired output encoding with
2488 <tt>i18n.logoutputencoding
</tt> in
<tt>.git/config
</tt> file, like this:
2490 <div class=
"listingblock">
2491 <div class=
"content">
2493 logoutputencoding = ISO-
8859-
1</tt></pre>
2495 <div class=
"para"><p>If you do not have this configuration variable, the value of
2496 <tt>i18n.commitencoding
</tt> is used instead.
</p></div>
2499 <div class=
"para"><p>Note that we deliberately chose not to re-code the commit log
2500 message when a commit is made to force UTF-
8 at the commit
2501 object level, because re-coding to UTF-
8 is not necessarily a
2502 reversible operation.
</p></div>
2504 <h2 id=
"_author">Author
</h2>
2505 <div class=
"sectionbody">
2506 <div class=
"para"><p>Written by Linus Torvalds
<torvalds@osdl.org
></p></div>
2508 <h2 id=
"_documentation">Documentation
</h2>
2509 <div class=
"sectionbody">
2510 <div class=
"para"><p>Documentation by David Greaves, Junio C Hamano and the git-list
<git@vger.kernel.org
>.
</p></div>
2512 <h2 id=
"_git">GIT
</h2>
2513 <div class=
"sectionbody">
2514 <div class=
"para"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
2517 <div id=
"footer-text">
2518 Last updated
2010-
01-
21 17:
44:
31 UTC