Autogenerated HTML docs for v1.7.6-472-g4bfe7
[git/jnareb-git.git] / git-blame.html
blob91b34abc8a8c049eb786b9c5b4b7ba740adfe377
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">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <meta name="generator" content="AsciiDoc 8.4.5" />
7 <title>git-blame(1)</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
12 border: 1px solid red;
16 body {
17 margin: 1em 5% 1em 5%;
20 a {
21 color: blue;
22 text-decoration: underline;
24 a:visited {
25 color: fuchsia;
28 em {
29 font-style: italic;
30 color: navy;
33 strong {
34 font-weight: bold;
35 color: #083194;
38 tt {
39 color: navy;
42 h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
53 h2 {
54 padding-top: 0.5em;
56 h3 {
57 float: left;
59 h3 + * {
60 clear: left;
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
68 hr {
69 border: 1px solid silver;
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
77 ul, ol, li > p {
78 margin-top: 0;
81 pre {
82 padding: 0;
83 margin: 0;
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
92 span#email {
94 span#revnumber, span#revdate, span#revremark {
95 font-family: sans-serif;
98 div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
114 div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120 div.admonitionblock {
121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.5em;
126 margin-bottom: 2.5em;
129 div.content { /* Block element content. */
130 padding: 0;
133 /* Block element titles. */
134 div.title, caption.title {
135 color: #527bbd;
136 font-family: sans-serif;
137 font-weight: bold;
138 text-align: left;
139 margin-top: 1.0em;
140 margin-bottom: 0.5em;
142 div.title + * {
143 margin-top: 0;
146 td div.title:first-child {
147 margin-top: 0.0em;
149 div.content div.title:first-child {
150 margin-top: 0.0em;
152 div.content + div.title {
153 margin-top: 0.0em;
156 div.sidebarblock > div.content {
157 background: #ffffee;
158 border: 1px solid silver;
159 padding: 0.5em;
162 div.listingblock > div.content {
163 border: 1px solid silver;
164 background: #f4f4f4;
165 padding: 0.5em;
168 div.quoteblock {
169 padding-left: 2.0em;
170 margin-right: 10%;
172 div.quoteblock > div.attribution {
173 padding-top: 0.5em;
174 text-align: right;
177 div.verseblock {
178 padding-left: 2.0em;
179 margin-right: 10%;
181 div.verseblock > div.content {
182 white-space: pre;
184 div.verseblock > div.attribution {
185 padding-top: 0.75em;
186 text-align: left;
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div.verseblock + div.attribution {
190 text-align: left;
193 div.admonitionblock .icon {
194 vertical-align: top;
195 font-size: 1.1em;
196 font-weight: bold;
197 text-decoration: underline;
198 color: #527bbd;
199 padding-right: 0.5em;
201 div.admonitionblock td.content {
202 padding-left: 0.5em;
203 border-left: 2px solid silver;
206 div.exampleblock > div.content {
207 border-left: 2px solid silver;
208 padding: 0.5em;
211 div.imageblock div.content { padding-left: 0; }
212 span.image img { border-style: none; }
213 a.image:visited { color: white; }
215 dl {
216 margin-top: 0.8em;
217 margin-bottom: 0.8em;
219 dt {
220 margin-top: 0.5em;
221 margin-bottom: 0;
222 font-style: normal;
223 color: navy;
225 dd > *:first-child {
226 margin-top: 0.1em;
229 ul, ol {
230 list-style-position: outside;
232 ol.arabic {
233 list-style-type: decimal;
235 ol.loweralpha {
236 list-style-type: lower-alpha;
238 ol.upperalpha {
239 list-style-type: upper-alpha;
241 ol.lowerroman {
242 list-style-type: lower-roman;
244 ol.upperroman {
245 list-style-type: upper-roman;
248 div.compact ul, div.compact ol,
249 div.compact p, div.compact p,
250 div.compact div, div.compact div {
251 margin-top: 0.1em;
252 margin-bottom: 0.1em;
255 div.tableblock > table {
256 border: 3px solid #527bbd;
258 thead {
259 font-family: sans-serif;
260 font-weight: bold;
262 tfoot {
263 font-weight: bold;
265 td > div.verse {
266 white-space: pre;
268 p.table {
269 margin-top: 0;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div.tableblock > table[frame="void"] {
273 border-style: none;
275 div.tableblock > table[frame="hsides"] {
276 border-left-style: none;
277 border-right-style: none;
279 div.tableblock > table[frame="vsides"] {
280 border-top-style: none;
281 border-bottom-style: none;
285 div.hdlist {
286 margin-top: 0.8em;
287 margin-bottom: 0.8em;
289 div.hdlist tr {
290 padding-bottom: 15px;
292 dt.hdlist1.strong, td.hdlist1.strong {
293 font-weight: bold;
295 td.hdlist1 {
296 vertical-align: top;
297 font-style: normal;
298 padding-right: 0.8em;
299 color: navy;
301 td.hdlist2 {
302 vertical-align: top;
304 div.hdlist.compact tr {
305 margin: 0;
306 padding-bottom: 0;
309 .comment {
310 background: yellow;
313 @media print {
314 div#footer-badges { display: none; }
317 div#toctitle {
318 color: #527bbd;
319 font-family: sans-serif;
320 font-size: 1.1em;
321 font-weight: bold;
322 margin-top: 1.0em;
323 margin-bottom: 0.1em;
326 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
327 margin-top: 0;
328 margin-bottom: 0;
330 div.toclevel2 {
331 margin-left: 2em;
332 font-size: 0.9em;
334 div.toclevel3 {
335 margin-left: 4em;
336 font-size: 0.9em;
338 div.toclevel4 {
339 margin-left: 6em;
340 font-size: 0.9em;
342 /* Overrides for manpage documents */
343 h1 {
344 padding-top: 0.5em;
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver;
347 border-bottom: 2px solid silver;
349 h2 {
350 border-style: none;
352 div.sectionbody {
353 margin-left: 5%;
356 @media print {
357 div#toc { display: none; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div.sidebar-content {
363 background: #ffffee;
364 border: 1px solid silver;
365 padding: 0.5em;
367 div.sidebar-title, div.image-title {
368 color: #527bbd;
369 font-family: sans-serif;
370 font-weight: bold;
371 margin-top: 0.0em;
372 margin-bottom: 0.5em;
375 div.listingblock div.content {
376 border: 1px solid silver;
377 background: #f4f4f4;
378 padding: 0.5em;
381 div.quoteblock-attribution {
382 padding-top: 0.5em;
383 text-align: right;
386 div.verseblock-content {
387 white-space: pre;
389 div.verseblock-attribution {
390 padding-top: 0.75em;
391 text-align: left;
394 div.exampleblock-content {
395 border-left: 2px solid silver;
396 padding-left: 0.5em;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc a:visited { color: blue; }
401 </style>
402 </head>
403 <body>
404 <div id="header">
405 <h1>
406 git-blame(1) Manual Page
407 </h1>
408 <h2>NAME</h2>
409 <div class="sectionbody">
410 <p>git-blame -
411 Show what revision and author last modified each line of a file
412 </p>
413 </div>
414 </div>
415 <h2 id="_synopsis">SYNOPSIS</h2>
416 <div class="sectionbody">
417 <div class="verseblock">
418 <div class="verseblock-content"><em>git blame</em> [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-e] [-p] [-w] [--incremental] [-L n,m]
419 [-S &lt;revs-file&gt;] [-M] [-C] [-C] [-C] [--since=&lt;date&gt;] [--abbrev=&lt;n&gt;]
420 [&lt;rev&gt; | --contents &lt;file&gt; | --reverse &lt;rev&gt;] [--] &lt;file&gt;</div>
421 <div class="verseblock-attribution">
422 </div></div>
423 </div>
424 <h2 id="_description">DESCRIPTION</h2>
425 <div class="sectionbody">
426 <div class="paragraph"><p>Annotates each line in the given file with information from the revision which
427 last modified the line. Optionally, start annotating from the given revision.</p></div>
428 <div class="paragraph"><p>The command can also limit the range of lines annotated.</p></div>
429 <div class="paragraph"><p>The report does not tell you anything about lines which have been deleted or
430 replaced; you need to use a tool such as <em>git diff</em> or the "pickaxe"
431 interface briefly mentioned in the following paragraph.</p></div>
432 <div class="paragraph"><p>Apart from supporting file annotation, git also supports searching the
433 development history for when a code snippet occurred in a change. This makes it
434 possible to track when a code snippet was added to a file, moved or copied
435 between files, and eventually deleted or replaced. It works by searching for
436 a text string in the diff. A small example:</p></div>
437 <div class="listingblock">
438 <div class="content">
439 <pre><tt>$ git log --pretty=oneline -S'blame_usage'
440 5040f17eba15504bad66b14a645bddd9b015ebb7 blame -S &lt;ancestry-file&gt;
441 ea4c7f9bf69e781dd0cd88d2bccb2bf5cc15c9a7 git-blame: Make the output</tt></pre>
442 </div></div>
443 </div>
444 <h2 id="_options">OPTIONS</h2>
445 <div class="sectionbody">
446 <div class="dlist"><dl>
447 <dt class="hdlist1">
449 </dt>
450 <dd>
452 Show blank SHA-1 for boundary commits. This can also
453 be controlled via the <tt>blame.blankboundary</tt> config option.
454 </p>
455 </dd>
456 <dt class="hdlist1">
457 --root
458 </dt>
459 <dd>
461 Do not treat root commits as boundaries. This can also be
462 controlled via the <tt>blame.showroot</tt> config option.
463 </p>
464 </dd>
465 <dt class="hdlist1">
466 --show-stats
467 </dt>
468 <dd>
470 Include additional statistics at the end of blame output.
471 </p>
472 </dd>
473 <dt class="hdlist1">
474 -L &lt;start&gt;,&lt;end&gt;
475 </dt>
476 <dd>
478 Annotate only the given line range. &lt;start&gt; and &lt;end&gt; can take
479 one of these forms:
480 </p>
481 <div class="ulist"><ul>
482 <li>
484 number
485 </p>
486 <div class="paragraph"><p>If &lt;start&gt; or &lt;end&gt; is a number, it specifies an
487 absolute line number (lines count from 1).</p></div>
488 </li>
489 <li>
491 /regex/
492 </p>
493 <div class="paragraph"><p>This form will use the first line matching the given
494 POSIX regex. If &lt;end&gt; is a regex, it will search
495 starting at the line given by &lt;start&gt;.</p></div>
496 </li>
497 <li>
499 +offset or -offset
500 </p>
501 <div class="paragraph"><p>This is only valid for &lt;end&gt; and will specify a number
502 of lines before or after the line given by &lt;start&gt;.</p></div>
503 </li>
504 </ul></div>
505 </dd>
506 <dt class="hdlist1">
508 </dt>
509 <dd>
511 Show long rev (Default: off).
512 </p>
513 </dd>
514 <dt class="hdlist1">
516 </dt>
517 <dd>
519 Show raw timestamp (Default: off).
520 </p>
521 </dd>
522 <dt class="hdlist1">
523 -S &lt;revs-file&gt;
524 </dt>
525 <dd>
527 Use revisions from revs-file instead of calling <a href="git-rev-list.html">git-rev-list(1)</a>.
528 </p>
529 </dd>
530 <dt class="hdlist1">
531 --reverse
532 </dt>
533 <dd>
535 Walk history forward instead of backward. Instead of showing
536 the revision in which a line appeared, this shows the last
537 revision in which a line has existed. This requires a range of
538 revision like START..END where the path to blame exists in
539 START.
540 </p>
541 </dd>
542 <dt class="hdlist1">
544 </dt>
545 <dt class="hdlist1">
546 --porcelain
547 </dt>
548 <dd>
550 Show in a format designed for machine consumption.
551 </p>
552 </dd>
553 <dt class="hdlist1">
554 --line-porcelain
555 </dt>
556 <dd>
558 Show the porcelain format, but output commit information for
559 each line, not just the first time a commit is referenced.
560 Implies --porcelain.
561 </p>
562 </dd>
563 <dt class="hdlist1">
564 --incremental
565 </dt>
566 <dd>
568 Show the result incrementally in a format designed for
569 machine consumption.
570 </p>
571 </dd>
572 <dt class="hdlist1">
573 --encoding=&lt;encoding&gt;
574 </dt>
575 <dd>
577 Specifies the encoding used to output author names
578 and commit summaries. Setting it to <tt>none</tt> makes blame
579 output unconverted data. For more information see the
580 discussion about encoding in the <a href="git-log.html">git-log(1)</a>
581 manual page.
582 </p>
583 </dd>
584 <dt class="hdlist1">
585 --contents &lt;file&gt;
586 </dt>
587 <dd>
589 When &lt;rev&gt; is not specified, the command annotates the
590 changes starting backwards from the working tree copy.
591 This flag makes the command pretend as if the working
592 tree copy has the contents of the named file (specify
593 <tt>-</tt> to make the command read from the standard input).
594 </p>
595 </dd>
596 <dt class="hdlist1">
597 --date &lt;format&gt;
598 </dt>
599 <dd>
601 The value is one of the following alternatives:
602 {relative,local,default,iso,rfc,short}. If --date is not
603 provided, the value of the blame.date config variable is
604 used. If the blame.date config variable is also not set, the
605 iso format is used. For more information, See the discussion
606 of the --date option at <a href="git-log.html">git-log(1)</a>.
607 </p>
608 </dd>
609 <dt class="hdlist1">
610 -M|&lt;num&gt;|
611 </dt>
612 <dd>
614 Detect moved or copied lines within a file. When a commit
615 moves or copies a block of lines (e.g. the original file
616 has A and then B, and the commit changes it to B and then
617 A), the traditional <em>blame</em> algorithm notices only half of
618 the movement and typically blames the lines that were moved
619 up (i.e. B) to the parent and assigns blame to the lines that
620 were moved down (i.e. A) to the child commit. With this
621 option, both groups of lines are blamed on the parent by
622 running extra passes of inspection.
623 </p>
624 <div class="paragraph"><p>&lt;num&gt; is optional but it is the lower bound on the number of
625 alphanumeric characters that git must detect as moving/copying
626 within a file for it to associate those lines with the parent
627 commit. The default value is 20.</p></div>
628 </dd>
629 <dt class="hdlist1">
630 -C|&lt;num&gt;|
631 </dt>
632 <dd>
634 In addition to <tt>-M</tt>, detect lines moved or copied from other
635 files that were modified in the same commit. This is
636 useful when you reorganize your program and move code
637 around across files. When this option is given twice,
638 the command additionally looks for copies from other
639 files in the commit that creates the file. When this
640 option is given three times, the command additionally
641 looks for copies from other files in any commit.
642 </p>
643 <div class="paragraph"><p>&lt;num&gt; is optional but it is the lower bound on the number of
644 alphanumeric characters that git must detect as moving/copying
645 between files for it to associate those lines with the parent
646 commit. And the default value is 40. If there are more than one
647 <tt>-C</tt> options given, the &lt;num&gt; argument of the last <tt>-C</tt> will
648 take effect.</p></div>
649 </dd>
650 <dt class="hdlist1">
652 </dt>
653 <dt class="hdlist1">
654 --help
655 </dt>
656 <dd>
658 Show help message.
659 </p>
660 </dd>
661 <dt class="hdlist1">
663 </dt>
664 <dd>
666 Use the same output mode as <a href="git-annotate.html">git-annotate(1)</a> (Default: off).
667 </p>
668 </dd>
669 <dt class="hdlist1">
670 --score-debug
671 </dt>
672 <dd>
674 Include debugging information related to the movement of
675 lines between files (see <tt>-C</tt>) and lines moved within a
676 file (see <tt>-M</tt>). The first number listed is the score.
677 This is the number of alphanumeric characters detected
678 as having been moved between or within files. This must be above
679 a certain threshold for <em>git blame</em> to consider those lines
680 of code to have been moved.
681 </p>
682 </dd>
683 <dt class="hdlist1">
685 </dt>
686 <dt class="hdlist1">
687 --show-name
688 </dt>
689 <dd>
691 Show the filename in the original commit. By default
692 the filename is shown if there is any line that came from a
693 file with a different name, due to rename detection.
694 </p>
695 </dd>
696 <dt class="hdlist1">
698 </dt>
699 <dt class="hdlist1">
700 --show-number
701 </dt>
702 <dd>
704 Show the line number in the original commit (Default: off).
705 </p>
706 </dd>
707 <dt class="hdlist1">
709 </dt>
710 <dd>
712 Suppress the author name and timestamp from the output.
713 </p>
714 </dd>
715 <dt class="hdlist1">
717 </dt>
718 <dt class="hdlist1">
719 --show-email
720 </dt>
721 <dd>
723 Show the author email instead of author name (Default: off).
724 </p>
725 </dd>
726 <dt class="hdlist1">
728 </dt>
729 <dd>
731 Ignore whitespace when comparing the parent&#8217;s version and
732 the child&#8217;s to find where the lines came from.
733 </p>
734 </dd>
735 <dt class="hdlist1">
736 --abbrev=&lt;n&gt;
737 </dt>
738 <dd>
740 Instead of using the default 7+1 hexadecimal digits as the
741 abbreviated object name, use &lt;n&gt;+1 digits. Note that 1 column
742 is used for a caret to mark the boundary commit.
743 </p>
744 </dd>
745 </dl></div>
746 </div>
747 <h2 id="_the_porcelain_format">THE PORCELAIN FORMAT</h2>
748 <div class="sectionbody">
749 <div class="paragraph"><p>In this format, each line is output after a header; the
750 header at the minimum has the first line which has:</p></div>
751 <div class="ulist"><ul>
752 <li>
754 40-byte SHA-1 of the commit the line is attributed to;
755 </p>
756 </li>
757 <li>
759 the line number of the line in the original file;
760 </p>
761 </li>
762 <li>
764 the line number of the line in the final file;
765 </p>
766 </li>
767 <li>
769 on a line that starts a group of lines from a different
770 commit than the previous one, the number of lines in this
771 group. On subsequent lines this field is absent.
772 </p>
773 </li>
774 </ul></div>
775 <div class="paragraph"><p>This header line is followed by the following information
776 at least once for each commit:</p></div>
777 <div class="ulist"><ul>
778 <li>
780 the author name ("author"), email ("author-mail"), time
781 ("author-time"), and timezone ("author-tz"); similarly
782 for committer.
783 </p>
784 </li>
785 <li>
787 the filename in the commit that the line is attributed to.
788 </p>
789 </li>
790 <li>
792 the first line of the commit log message ("summary").
793 </p>
794 </li>
795 </ul></div>
796 <div class="paragraph"><p>The contents of the actual line is output after the above
797 header, prefixed by a TAB. This is to allow adding more
798 header elements later.</p></div>
799 <div class="paragraph"><p>The porcelain format generally suppresses commit information that has
800 already been seen. For example, two lines that are blamed to the same
801 commit will both be shown, but the details for that commit will be shown
802 only once. This is more efficient, but may require more state be kept by
803 the reader. The <tt>--line-porcelain</tt> option can be used to output full
804 commit information for each line, allowing simpler (but less efficient)
805 usage like:</p></div>
806 <div class="literalblock">
807 <div class="content">
808 <pre><tt># count the number of lines attributed to each author
809 git blame --line-porcelain file |
810 sed -n 's/^author //p' |
811 sort | uniq -c | sort -rn</tt></pre>
812 </div></div>
813 </div>
814 <h2 id="_specifying_ranges">SPECIFYING RANGES</h2>
815 <div class="sectionbody">
816 <div class="paragraph"><p>Unlike <em>git blame</em> and <em>git annotate</em> in older versions of git, the extent
817 of the annotation can be limited to both line ranges and revision
818 ranges. When you are interested in finding the origin for
819 lines 40-60 for file <tt>foo</tt>, you can use the <tt>-L</tt> option like so
820 (they mean the same thing&#8201;&#8212;&#8201;both ask for 21 lines starting at
821 line 40):</p></div>
822 <div class="literalblock">
823 <div class="content">
824 <pre><tt>git blame -L 40,60 foo
825 git blame -L 40,+21 foo</tt></pre>
826 </div></div>
827 <div class="paragraph"><p>Also you can use a regular expression to specify the line range:</p></div>
828 <div class="literalblock">
829 <div class="content">
830 <pre><tt>git blame -L '/^sub hello {/,/^}$/' foo</tt></pre>
831 </div></div>
832 <div class="paragraph"><p>which limits the annotation to the body of the <tt>hello</tt> subroutine.</p></div>
833 <div class="paragraph"><p>When you are not interested in changes older than version
834 v2.6.18, or changes older than 3 weeks, you can use revision
835 range specifiers similar to <em>git rev-list</em>:</p></div>
836 <div class="literalblock">
837 <div class="content">
838 <pre><tt>git blame v2.6.18.. -- foo
839 git blame --since=3.weeks -- foo</tt></pre>
840 </div></div>
841 <div class="paragraph"><p>When revision range specifiers are used to limit the annotation,
842 lines that have not changed since the range boundary (either the
843 commit v2.6.18 or the most recent commit that is more than 3
844 weeks old in the above example) are blamed for that range
845 boundary commit.</p></div>
846 <div class="paragraph"><p>A particularly useful way is to see if an added file has lines
847 created by copy-and-paste from existing files. Sometimes this
848 indicates that the developer was being sloppy and did not
849 refactor the code properly. You can first find the commit that
850 introduced the file with:</p></div>
851 <div class="literalblock">
852 <div class="content">
853 <pre><tt>git log --diff-filter=A --pretty=short -- foo</tt></pre>
854 </div></div>
855 <div class="paragraph"><p>and then annotate the change between the commit and its
856 parents, using <tt>commit&#94;!</tt> notation:</p></div>
857 <div class="literalblock">
858 <div class="content">
859 <pre><tt>git blame -C -C -f $commit^! -- foo</tt></pre>
860 </div></div>
861 </div>
862 <h2 id="_incremental_output">INCREMENTAL OUTPUT</h2>
863 <div class="sectionbody">
864 <div class="paragraph"><p>When called with <tt>--incremental</tt> option, the command outputs the
865 result as it is built. The output generally will talk about
866 lines touched by more recent commits first (i.e. the lines will
867 be annotated out of order) and is meant to be used by
868 interactive viewers.</p></div>
869 <div class="paragraph"><p>The output format is similar to the Porcelain format, but it
870 does not contain the actual lines from the file that is being
871 annotated.</p></div>
872 <div class="olist arabic"><ol class="arabic">
873 <li>
875 Each blame entry always starts with a line of:
876 </p>
877 <div class="literalblock">
878 <div class="content">
879 <pre><tt>&lt;40-byte hex sha1&gt; &lt;sourceline&gt; &lt;resultline&gt; &lt;num_lines&gt;</tt></pre>
880 </div></div>
881 <div class="paragraph"><p>Line numbers count from 1.</p></div>
882 </li>
883 <li>
885 The first time that a commit shows up in the stream, it has various
886 other information about it printed out with a one-word tag at the
887 beginning of each line describing the extra commit information (author,
888 email, committer, dates, summary, etc.).
889 </p>
890 </li>
891 <li>
893 Unlike the Porcelain format, the filename information is always
894 given and terminates the entry:
895 </p>
896 <div class="literalblock">
897 <div class="content">
898 <pre><tt>"filename" &lt;whitespace-quoted-filename-goes-here&gt;</tt></pre>
899 </div></div>
900 <div class="paragraph"><p>and thus it is really quite easy to parse for some line- and word-oriented
901 parser (which should be quite natural for most scripting languages).</p></div>
902 <div class="admonitionblock">
903 <table><tr>
904 <td class="icon">
905 <div class="title">Note</div>
906 </td>
907 <td class="content">For people who do parsing: to make it more robust, just ignore any
908 lines between the first and last one ("&lt;sha1&gt;" and "filename" lines)
909 where you do not recognize the tag words (or care about that particular
910 one) at the beginning of the "extended information" lines. That way, if
911 there is ever added information (like the commit encoding or extended
912 commit commentary), a blame viewer will not care.</td>
913 </tr></table>
914 </div>
915 </li>
916 </ol></div>
917 </div>
918 <h2 id="_mapping_authors">MAPPING AUTHORS</h2>
919 <div class="sectionbody">
920 <div class="paragraph"><p>If the file <tt>.mailmap</tt> exists at the toplevel of the repository, or at
921 the location pointed to by the mailmap.file configuration option, it
922 is used to map author and committer names and email addresses to
923 canonical real names and email addresses.</p></div>
924 <div class="paragraph"><p>In the simple form, each line in the file consists of the canonical
925 real name of an author, whitespace, and an email address used in the
926 commit (enclosed by <em>&lt;</em> and <em>&gt;</em>) to map to the name. For example:</p></div>
927 <div class="literalblock">
928 <div class="content">
929 <pre><tt>Proper Name &lt;commit@email.xx&gt;</tt></pre>
930 </div></div>
931 <div class="paragraph"><p>The more complex forms are:</p></div>
932 <div class="literalblock">
933 <div class="content">
934 <pre><tt>&lt;proper@email.xx&gt; &lt;commit@email.xx&gt;</tt></pre>
935 </div></div>
936 <div class="paragraph"><p>which allows mailmap to replace only the email part of a commit, and:</p></div>
937 <div class="literalblock">
938 <div class="content">
939 <pre><tt>Proper Name &lt;proper@email.xx&gt; &lt;commit@email.xx&gt;</tt></pre>
940 </div></div>
941 <div class="paragraph"><p>which allows mailmap to replace both the name and the email of a
942 commit matching the specified commit email address, and:</p></div>
943 <div class="literalblock">
944 <div class="content">
945 <pre><tt>Proper Name &lt;proper@email.xx&gt; Commit Name &lt;commit@email.xx&gt;</tt></pre>
946 </div></div>
947 <div class="paragraph"><p>which allows mailmap to replace both the name and the email of a
948 commit matching both the specified commit name and email address.</p></div>
949 <div class="paragraph"><p>Example 1: Your history contains commits by two authors, Jane
950 and Joe, whose names appear in the repository under several forms:</p></div>
951 <div class="listingblock">
952 <div class="content">
953 <pre><tt>Joe Developer &lt;joe@example.com&gt;
954 Joe R. Developer &lt;joe@example.com&gt;
955 Jane Doe &lt;jane@example.com&gt;
956 Jane Doe &lt;jane@laptop.(none)&gt;
957 Jane D. &lt;jane@desktop.(none)&gt;</tt></pre>
958 </div></div>
959 <div class="paragraph"><p>Now suppose that Joe wants his middle name initial used, and Jane
960 prefers her family name fully spelled out. A proper <tt>.mailmap</tt> file
961 would look like:</p></div>
962 <div class="listingblock">
963 <div class="content">
964 <pre><tt>Jane Doe &lt;jane@desktop.(none)&gt;
965 Joe R. Developer &lt;joe@example.com&gt;</tt></pre>
966 </div></div>
967 <div class="paragraph"><p>Note how there is no need for an entry for &lt;<a href="mailto:jane@laptop">jane@laptop</a>.(none)&gt;, because the
968 real name of that author is already correct.</p></div>
969 <div class="paragraph"><p>Example 2: Your repository contains commits from the following
970 authors:</p></div>
971 <div class="listingblock">
972 <div class="content">
973 <pre><tt>nick1 &lt;bugs@company.xx&gt;
974 nick2 &lt;bugs@company.xx&gt;
975 nick2 &lt;nick2@company.xx&gt;
976 santa &lt;me@company.xx&gt;
977 claus &lt;me@company.xx&gt;
978 CTO &lt;cto@coompany.xx&gt;</tt></pre>
979 </div></div>
980 <div class="paragraph"><p>Then you might want a <tt>.mailmap</tt> file that looks like:</p></div>
981 <div class="listingblock">
982 <div class="content">
983 <pre><tt>&lt;cto@company.xx&gt; &lt;cto@coompany.xx&gt;
984 Some Dude &lt;some@dude.xx&gt; nick1 &lt;bugs@company.xx&gt;
985 Other Author &lt;other@author.xx&gt; nick2 &lt;bugs@company.xx&gt;
986 Other Author &lt;other@author.xx&gt; &lt;nick2@company.xx&gt;
987 Santa Claus &lt;santa.claus@northpole.xx&gt; &lt;me@company.xx&gt;</tt></pre>
988 </div></div>
989 <div class="paragraph"><p>Use hash <em>#</em> for comments that are either on their own line, or after
990 the email address.</p></div>
991 </div>
992 <h2 id="_see_also">SEE ALSO</h2>
993 <div class="sectionbody">
994 <div class="paragraph"><p><a href="git-annotate.html">git-annotate(1)</a></p></div>
995 </div>
996 <h2 id="_git">GIT</h2>
997 <div class="sectionbody">
998 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
999 </div>
1000 <div id="footer">
1001 <div id="footer-text">
1002 Last updated 2011-05-23 23:05:02 UTC
1003 </div>
1004 </div>
1005 </body>
1006 </html>