blob: 9979ab8724b43337e701f80c337db3b03ee749bc [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231<!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" />
Junio C Hamano7bd050f2011-09-22 06:32:226<meta name="generator" content="AsciiDoc 8.5.2" />
Junio C Hamano68cf15a2010-11-06 01:01:597<title>git-format-patch(1)</title>
Junio C Hamano1a4e8412005-12-27 08:17:238<style type="text/css">
9/* Debug borders */
10p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
11/*
12 border: 1px solid red;
13*/
14}
15
16body {
17 margin: 1em 5% 1em 5%;
18}
19
Junio C Hamanoba4b9282008-07-06 05:20:3120a {
21 color: blue;
22 text-decoration: underline;
23}
24a:visited {
25 color: fuchsia;
26}
Junio C Hamano1a4e8412005-12-27 08:17:2327
28em {
29 font-style: italic;
Junio C Hamano68cf15a2010-11-06 01:01:5930 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2331}
32
33strong {
34 font-weight: bold;
Junio C Hamano68cf15a2010-11-06 01:01:5935 color: #083194;
Junio C Hamano1a4e8412005-12-27 08:17:2336}
37
38tt {
39 color: navy;
40}
41
42h1, 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;
48}
49
Junio C Hamanoba4b9282008-07-06 05:20:3150h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2351 border-bottom: 2px solid silver;
52}
53h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2354 padding-top: 0.5em;
55}
Junio C Hamanoba4b9282008-07-06 05:20:3156h3 {
57 float: left;
58}
59h3 + * {
60 clear: left;
61}
Junio C Hamano1a4e8412005-12-27 08:17:2362
63div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
66}
67
68hr {
69 border: 1px solid silver;
70}
71
72p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
75}
76
Junio C Hamano68cf15a2010-11-06 01:01:5977ul, ol, li > p {
78 margin-top: 0;
79}
80
Junio C Hamano1a4e8412005-12-27 08:17:2381pre {
82 padding: 0;
83 margin: 0;
84}
85
86span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:3190 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:2391}
92span#email {
93}
Junio C Hamano68cf15a2010-11-06 01:01:5994span#revnumber, span#revdate, span#revremark {
Junio C Hamano1a4e8412005-12-27 08:17:2395 font-family: sans-serif;
96}
97
98div#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;
104}
105div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
108}
109div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
112}
113
Junio C Hamano68cf15a2010-11-06 01:01:59114div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
117}
Junio C Hamano1a4e8412005-12-27 08:17:23118div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22121 margin-top: 1.0em;
Junio C Hamano1a4e8412005-12-27 08:17:23122 margin-bottom: 1.5em;
123}
124div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22125 margin-top: 2.0em;
126 margin-bottom: 2.0em;
127 margin-right: 10%;
128 color: #606060;
Junio C Hamano1a4e8412005-12-27 08:17:23129}
130
131div.content { /* Block element content. */
132 padding: 0;
133}
134
135/* Block element titles. */
136div.title, caption.title {
Junio C Hamano68cf15a2010-11-06 01:01:59137 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23138 font-family: sans-serif;
139 font-weight: bold;
140 text-align: left;
141 margin-top: 1.0em;
142 margin-bottom: 0.5em;
143}
144div.title + * {
145 margin-top: 0;
146}
147
148td div.title:first-child {
149 margin-top: 0.0em;
150}
151div.content div.title:first-child {
152 margin-top: 0.0em;
153}
154div.content + div.title {
155 margin-top: 0.0em;
156}
157
158div.sidebarblock > div.content {
159 background: #ffffee;
160 border: 1px solid silver;
161 padding: 0.5em;
162}
163
164div.listingblock > div.content {
165 border: 1px solid silver;
166 background: #f4f4f4;
167 padding: 0.5em;
168}
169
Junio C Hamano7bd050f2011-09-22 06:32:22170div.quoteblock, div.verseblock {
171 padding-left: 1.0em;
172 margin-left: 1.0em;
Junio C Hamano68cf15a2010-11-06 01:01:59173 margin-right: 10%;
Junio C Hamano7bd050f2011-09-22 06:32:22174 border-left: 5px solid #dddddd;
175 color: #777777;
Junio C Hamano1a4e8412005-12-27 08:17:23176}
Junio C Hamano7bd050f2011-09-22 06:32:22177
Junio C Hamano68cf15a2010-11-06 01:01:59178div.quoteblock > div.attribution {
179 padding-top: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23180 text-align: right;
181}
Junio C Hamano68cf15a2010-11-06 01:01:59182
Junio C Hamano68cf15a2010-11-06 01:01:59183div.verseblock > div.content {
184 white-space: pre;
185}
186div.verseblock > div.attribution {
187 padding-top: 0.75em;
188 text-align: left;
189}
190/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamanoba4b9282008-07-06 05:20:31191div.verseblock + div.attribution {
192 text-align: left;
193}
Junio C Hamano1a4e8412005-12-27 08:17:23194
195div.admonitionblock .icon {
196 vertical-align: top;
197 font-size: 1.1em;
198 font-weight: bold;
199 text-decoration: underline;
200 color: #527bbd;
201 padding-right: 0.5em;
202}
203div.admonitionblock td.content {
204 padding-left: 0.5em;
Junio C Hamano7bd050f2011-09-22 06:32:22205 border-left: 3px solid #dddddd;
Junio C Hamano1a4e8412005-12-27 08:17:23206}
207
208div.exampleblock > div.content {
Junio C Hamano7bd050f2011-09-22 06:32:22209 border-left: 3px solid #dddddd;
210 padding-left: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23211}
212
Junio C Hamano1a4e8412005-12-27 08:17:23213div.imageblock div.content { padding-left: 0; }
Junio C Hamano1a4e8412005-12-27 08:17:23214span.image img { border-style: none; }
Junio C Hamano68cf15a2010-11-06 01:01:59215a.image:visited { color: white; }
Junio C Hamano1a4e8412005-12-27 08:17:23216
217dl {
218 margin-top: 0.8em;
219 margin-bottom: 0.8em;
220}
221dt {
222 margin-top: 0.5em;
223 margin-bottom: 0;
Junio C Hamano68cf15a2010-11-06 01:01:59224 font-style: normal;
225 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23226}
227dd > *:first-child {
Junio C Hamano68cf15a2010-11-06 01:01:59228 margin-top: 0.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23229}
230
231ul, ol {
232 list-style-position: outside;
233}
Junio C Hamano68cf15a2010-11-06 01:01:59234ol.arabic {
235 list-style-type: decimal;
236}
237ol.loweralpha {
Junio C Hamano1a4e8412005-12-27 08:17:23238 list-style-type: lower-alpha;
239}
Junio C Hamano68cf15a2010-11-06 01:01:59240ol.upperalpha {
241 list-style-type: upper-alpha;
242}
243ol.lowerroman {
244 list-style-type: lower-roman;
245}
246ol.upperroman {
247 list-style-type: upper-roman;
248}
249
250div.compact ul, div.compact ol,
251div.compact p, div.compact p,
252div.compact div, div.compact div {
253 margin-top: 0.1em;
254 margin-bottom: 0.1em;
255}
Junio C Hamano1a4e8412005-12-27 08:17:23256
257div.tableblock > table {
Junio C Hamanoba4b9282008-07-06 05:20:31258 border: 3px solid #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23259}
Junio C Hamano7bd050f2011-09-22 06:32:22260thead, p.table.header {
Junio C Hamano1a4e8412005-12-27 08:17:23261 font-family: sans-serif;
262 font-weight: bold;
263}
264tfoot {
265 font-weight: bold;
266}
Junio C Hamano68cf15a2010-11-06 01:01:59267td > div.verse {
268 white-space: pre;
269}
270p.table {
271 margin-top: 0;
272}
273/* Because the table frame attribute is overriden by CSS in most browsers. */
274div.tableblock > table[frame="void"] {
275 border-style: none;
276}
277div.tableblock > table[frame="hsides"] {
278 border-left-style: none;
279 border-right-style: none;
280}
281div.tableblock > table[frame="vsides"] {
282 border-top-style: none;
283 border-bottom-style: none;
284}
Junio C Hamano1a4e8412005-12-27 08:17:23285
Junio C Hamano68cf15a2010-11-06 01:01:59286
287div.hdlist {
Junio C Hamano1a4e8412005-12-27 08:17:23288 margin-top: 0.8em;
289 margin-bottom: 0.8em;
290}
Junio C Hamano68cf15a2010-11-06 01:01:59291div.hdlist tr {
292 padding-bottom: 15px;
Junio C Hamanoba4b9282008-07-06 05:20:31293}
Junio C Hamano68cf15a2010-11-06 01:01:59294dt.hdlist1.strong, td.hdlist1.strong {
295 font-weight: bold;
296}
297td.hdlist1 {
Junio C Hamano1a4e8412005-12-27 08:17:23298 vertical-align: top;
Junio C Hamano68cf15a2010-11-06 01:01:59299 font-style: normal;
Junio C Hamano1a4e8412005-12-27 08:17:23300 padding-right: 0.8em;
Junio C Hamano68cf15a2010-11-06 01:01:59301 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23302}
Junio C Hamano68cf15a2010-11-06 01:01:59303td.hdlist2 {
Junio C Hamano1a4e8412005-12-27 08:17:23304 vertical-align: top;
305}
Junio C Hamano68cf15a2010-11-06 01:01:59306div.hdlist.compact tr {
307 margin: 0;
308 padding-bottom: 0;
309}
310
311.comment {
312 background: yellow;
313}
Junio C Hamano1a4e8412005-12-27 08:17:23314
Junio C Hamano7bd050f2011-09-22 06:32:22315.footnote, .footnoteref {
316 font-size: 0.8em;
317}
318
319span.footnote, span.footnoteref {
320 vertical-align: super;
321}
322
323#footnotes {
324 margin: 20px 0 20px 0;
325 padding: 7px 0 0 0;
326}
327
328#footnotes div.footnote {
329 margin: 0 0 5px 0;
330}
331
332#footnotes hr {
333 border: none;
334 border-top: 1px solid silver;
335 height: 1px;
336 text-align: left;
337 margin-left: 0;
338 width: 20%;
339 min-width: 100px;
340}
341
342
Junio C Hamano1a4e8412005-12-27 08:17:23343@media print {
344 div#footer-badges { display: none; }
345}
Junio C Hamanoba4b9282008-07-06 05:20:31346
Junio C Hamano7bd050f2011-09-22 06:32:22347div#toc {
348 margin-bottom: 2.5em;
349}
350
Junio C Hamanoba4b9282008-07-06 05:20:31351div#toctitle {
352 color: #527bbd;
353 font-family: sans-serif;
354 font-size: 1.1em;
355 font-weight: bold;
356 margin-top: 1.0em;
357 margin-bottom: 0.1em;
358}
359
360div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
361 margin-top: 0;
362 margin-bottom: 0;
363}
364div.toclevel2 {
365 margin-left: 2em;
366 font-size: 0.9em;
367}
368div.toclevel3 {
369 margin-left: 4em;
370 font-size: 0.9em;
371}
372div.toclevel4 {
373 margin-left: 6em;
374 font-size: 0.9em;
375}
Junio C Hamano68cf15a2010-11-06 01:01:59376/* Overrides for manpage documents */
377h1 {
378 padding-top: 0.5em;
379 padding-bottom: 0.5em;
380 border-top: 2px solid silver;
381 border-bottom: 2px solid silver;
382}
383h2 {
384 border-style: none;
385}
386div.sectionbody {
387 margin-left: 5%;
388}
389
390@media print {
391 div#toc { display: none; }
392}
393
Junio C Hamano1a4e8412005-12-27 08:17:23394/* Workarounds for IE6's broken and incomplete CSS2. */
395
396div.sidebar-content {
397 background: #ffffee;
398 border: 1px solid silver;
399 padding: 0.5em;
400}
401div.sidebar-title, div.image-title {
Junio C Hamano68cf15a2010-11-06 01:01:59402 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23403 font-family: sans-serif;
404 font-weight: bold;
405 margin-top: 0.0em;
406 margin-bottom: 0.5em;
407}
408
409div.listingblock div.content {
410 border: 1px solid silver;
411 background: #f4f4f4;
412 padding: 0.5em;
413}
414
Junio C Hamano68cf15a2010-11-06 01:01:59415div.quoteblock-attribution {
416 padding-top: 0.5em;
417 text-align: right;
418}
419
420div.verseblock-content {
421 white-space: pre;
422}
423div.verseblock-attribution {
424 padding-top: 0.75em;
425 text-align: left;
Junio C Hamano1a4e8412005-12-27 08:17:23426}
427
428div.exampleblock-content {
Junio C Hamano7bd050f2011-09-22 06:32:22429 border-left: 3px solid #dddddd;
Junio C Hamano1a4e8412005-12-27 08:17:23430 padding-left: 0.5em;
431}
Junio C Hamanoba4b9282008-07-06 05:20:31432
433/* IE6 sets dynamically generated links as visited. */
434div#toc a:visited { color: blue; }
Junio C Hamano1a4e8412005-12-27 08:17:23435</style>
Junio C Hamano7bd050f2011-09-22 06:32:22436<script type="text/javascript">
437/*<![CDATA[*/
438window.onload = function(){asciidoc.footnotes();}
439var asciidoc = { // Namespace.
440
441/////////////////////////////////////////////////////////////////////
442// Table Of Contents generator
443/////////////////////////////////////////////////////////////////////
444
445/* Author: Mihai Bazon, September 2002
446 * http://students.infoiasi.ro/~mishoo
447 *
448 * Table Of Content generator
449 * Version: 0.4
450 *
451 * Feel free to use this script under the terms of the GNU General Public
452 * License, as long as you do not remove or alter this notice.
453 */
454
455 /* modified by Troy D. Hanson, September 2006. License: GPL */
456 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
457
458// toclevels = 1..4.
459toc: function (toclevels) {
460
461 function getText(el) {
462 var text = "";
463 for (var i = el.firstChild; i != null; i = i.nextSibling) {
464 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
465 text += i.data;
466 else if (i.firstChild != null)
467 text += getText(i);
468 }
469 return text;
470 }
471
472 function TocEntry(el, text, toclevel) {
473 this.element = el;
474 this.text = text;
475 this.toclevel = toclevel;
476 }
477
478 function tocEntries(el, toclevels) {
479 var result = new Array;
480 var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
481 // Function that scans the DOM tree for header elements (the DOM2
482 // nodeIterator API would be a better technique but not supported by all
483 // browsers).
484 var iterate = function (el) {
485 for (var i = el.firstChild; i != null; i = i.nextSibling) {
486 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
487 var mo = re.exec(i.tagName);
488 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
489 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
490 }
491 iterate(i);
492 }
493 }
494 }
495 iterate(el);
496 return result;
497 }
498
499 var toc = document.getElementById("toc");
500 var entries = tocEntries(document.getElementById("content"), toclevels);
501 for (var i = 0; i < entries.length; ++i) {
502 var entry = entries[i];
503 if (entry.element.id == "")
504 entry.element.id = "_toc_" + i;
505 var a = document.createElement("a");
506 a.href = "#" + entry.element.id;
507 a.appendChild(document.createTextNode(entry.text));
508 var div = document.createElement("div");
509 div.appendChild(a);
510 div.className = "toclevel" + entry.toclevel;
511 toc.appendChild(div);
512 }
513 if (entries.length == 0)
514 toc.parentNode.removeChild(toc);
515},
516
517
518/////////////////////////////////////////////////////////////////////
519// Footnotes generator
520/////////////////////////////////////////////////////////////////////
521
522/* Based on footnote generation code from:
523 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
524 */
525
526footnotes: function () {
527 var cont = document.getElementById("content");
528 var noteholder = document.getElementById("footnotes");
529 var spans = cont.getElementsByTagName("span");
530 var refs = {};
531 var n = 0;
532 for (i=0; i<spans.length; i++) {
533 if (spans[i].className == "footnote") {
534 n++;
535 // Use [\s\S] in place of . so multi-line matches work.
536 // Because JavaScript has no s (dotall) regex flag.
537 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
538 noteholder.innerHTML +=
539 "<div class='footnote' id='_footnote_" + n + "'>" +
540 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
541 n + "</a>. " + note + "</div>";
542 spans[i].innerHTML =
543 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
544 "' title='View footnote' class='footnote'>" + n + "</a>]";
545 var id =spans[i].getAttribute("id");
546 if (id != null) refs["#"+id] = n;
547 }
548 }
549 if (n == 0)
550 noteholder.parentNode.removeChild(noteholder);
551 else {
552 // Process footnoterefs.
553 for (i=0; i<spans.length; i++) {
554 if (spans[i].className == "footnoteref") {
555 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
556 href = href.match(/#.*/)[0]; // Because IE return full URL.
557 n = refs[href];
558 spans[i].innerHTML =
559 "[<a href='#_footnote_" + n +
560 "' title='View footnote' class='footnote'>" + n + "</a>]";
561 }
562 }
563 }
564}
565
566}
567/*]]>*/
568</script>
Junio C Hamano1a4e8412005-12-27 08:17:23569</head>
570<body>
571<div id="header">
572<h1>
573git-format-patch(1) Manual Page
574</h1>
575<h2>NAME</h2>
576<div class="sectionbody">
577<p>git-format-patch -
Junio C Hamano01078922006-03-10 00:31:47578 Prepare patches for e-mail submission
Junio C Hamano1a4e8412005-12-27 08:17:23579</p>
580</div>
581</div>
Junio C Hamano7bd050f2011-09-22 06:32:22582<div id="content">
Junio C Hamano68cf15a2010-11-06 01:01:59583<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23584<div class="sectionbody">
Junio C Hamano235a91e2006-01-07 01:13:58585<div class="verseblock">
Junio C Hamano68cf15a2010-11-06 01:01:59586<div class="verseblock-content"><em>git format-patch</em> [-k] [(-o|--output-directory) &lt;dir&gt; | --stdout]
Junio C Hamano1bbd0f42009-07-23 06:20:29587 [--no-thread | --thread[=&lt;style&gt;]]
Junio C Hamanof4581102009-04-25 08:29:59588 [(--attach|--inline)[=&lt;boundary&gt;] | --no-attach]
589 [-s | --signoff]
Junio C Hamano89a57342010-06-22 23:22:55590 [--signature=&lt;signature&gt; | --no-signature]
Junio C Hamano8c5802d2007-11-15 00:13:36591 [-n | --numbered | -N | --no-numbered]
Junio C Hamano94cad1a2007-06-06 10:48:25592 [--start-number &lt;n&gt;] [--numbered-files]
Junio C Hamano4f9a6052007-01-17 20:25:16593 [--in-reply-to=Message-Id] [--suffix=.&lt;sfx&gt;]
Junio C Hamano7c73c662007-01-19 00:37:50594 [--ignore-if-in-upstream]
Junio C Hamano6f1cca82007-04-12 05:02:47595 [--subject-prefix=Subject-Prefix]
Junio C Hamanoea90ab32010-03-15 20:32:55596 [--to=&lt;email&gt;] [--cc=&lt;email&gt;]
Junio C Hamano209ebe82011-04-27 21:09:59597 [--cover-letter] [--quiet]
Junio C Hamanof4581102009-04-25 08:29:59598 [&lt;common diff options&gt;]
Junio C Hamano68cf15a2010-11-06 01:01:59599 [ &lt;since&gt; | &lt;revision range&gt; ]</div>
600<div class="verseblock-attribution">
601</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23602</div>
Junio C Hamanoba4b9282008-07-06 05:20:31603<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23604<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59605<div class="paragraph"><p>Prepare each commit with its patch in
Junio C Hamano341071d2006-06-04 07:24:48606one file per commit, formatted to resemble UNIX mailbox format.
Junio C Hamano7d9e9bd2007-08-29 07:31:47607The output of this command is convenient for e-mail submission or
Junio C Hamano1aa40d22010-01-21 17:46:43608for use with <em>git am</em>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59609<div class="paragraph"><p>There are two ways to specify which commits to operate on.</p></div>
610<div class="olist arabic"><ol class="arabic">
Junio C Hamano7d9e9bd2007-08-29 07:31:47611<li>
612<p>
613A single commit, &lt;since&gt;, specifies that the commits leading
614 to the tip of the current branch that are not in the history
615 that leads to the &lt;since&gt; to be output.
616</p>
617</li>
618<li>
619<p>
620Generic &lt;revision range&gt; expression (see "SPECIFYING
Junio C Hamanoa28a9202012-06-21 07:08:23621 REVISIONS" section in <a href="gitrevisions.html">gitrevisions(7)</a>) means the
Junio C Hamano7d9e9bd2007-08-29 07:31:47622 commits in the specified range.
623</p>
624</li>
Junio C Hamanoba4b9282008-07-06 05:20:31625</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:59626<div class="paragraph"><p>The first rule takes precedence in the case of a single &lt;commit&gt;. To
Junio C Hamano9572e922009-04-02 06:52:03627apply the second rule, i.e., format everything since the beginning of
Junio C Hamano3b70d3c2009-11-21 17:37:37628history up until &lt;commit&gt;, use the <em>--root</em> option: <tt>git format-patch
629--root &lt;commit&gt;</tt>. If you want to format only &lt;commit&gt; itself, you
630can do this with <tt>git format-patch -1 &lt;commit&gt;</tt>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59631<div class="paragraph"><p>By default, each output file is numbered sequentially from 1, and uses the
Junio C Hamano341071d2006-06-04 07:24:48632first line of the commit message (massaged for pathname safety) as
Junio C Hamano3b70d3c2009-11-21 17:37:37633the filename. With the <tt>--numbered-files</tt> option, the output file names
Junio C Hamano94cad1a2007-06-06 10:48:25634will only be numbers, without the first line of the commit appended.
635The names of the output files are printed to standard
Junio C Hamano3b70d3c2009-11-21 17:37:37636output, unless the <tt>--stdout</tt> option is specified.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59637<div class="paragraph"><p>If <tt>-o</tt> is specified, output files are created in &lt;dir&gt;. Otherwise
Junio C Hamanoba4b9282008-07-06 05:20:31638they are created in the current working directory.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59639<div class="paragraph"><p>By default, the subject of a single patch is "[PATCH] First Line" and
Junio C Hamano7d06a8a2008-10-20 05:42:33640the subject when multiple patches are output is "[PATCH n/m] First
Junio C Hamano3b70d3c2009-11-21 17:37:37641Line". To force 1/1 to be added for a single patch, use <tt>-n</tt>. To omit
642patch numbers from the subject, use <tt>-N</tt>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59643<div class="paragraph"><p>If given <tt>--thread</tt>, <tt>git-format-patch</tt> will generate <tt>In-Reply-To</tt> and
Junio C Hamano3b70d3c2009-11-21 17:37:37644<tt>References</tt> headers to make the second and subsequent patch mails appear
645as replies to the first mail; this also generates a <tt>Message-Id</tt> header to
Junio C Hamanoba4b9282008-07-06 05:20:31646reference.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23647</div>
Junio C Hamanoba4b9282008-07-06 05:20:31648<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23649<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59650<div class="dlist"><dl>
651<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26652-p
653</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59654<dt class="hdlist1">
Junio C Hamano3b70d3c2009-11-21 17:37:37655--no-stat
656</dt>
Junio C Hamano60f8aa82007-03-06 09:58:26657<dd>
658<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37659 Generate plain patches without any diffstats.
Junio C Hamano60f8aa82007-03-06 09:58:26660</p>
661</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59662<dt class="hdlist1">
Junio C Hamano69361562007-07-26 02:14:34663-U&lt;n&gt;
664</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59665<dt class="hdlist1">
Junio C Hamano69361562007-07-26 02:14:34666--unified=&lt;n&gt;
667</dt>
668<dd>
669<p>
670 Generate diffs with &lt;n&gt; lines of context instead of
Junio C Hamano3b70d3c2009-11-21 17:37:37671 the usual three.
Junio C Hamano60f8aa82007-03-06 09:58:26672</p>
673</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59674<dt class="hdlist1">
Junio C Hamano5a73f302011-10-14 05:58:34675--minimal
676</dt>
677<dd>
678<p>
679 Spend extra time to make sure the smallest possible
680 diff is produced.
681</p>
682</dd>
683<dt class="hdlist1">
Junio C Hamano20d47e32009-01-26 06:36:02684--patience
685</dt>
686<dd>
687<p>
688 Generate a diff using the "patience diff" algorithm.
689</p>
690</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59691<dt class="hdlist1">
Junio C Hamanoaea9e6b2012-03-07 00:17:11692--histogram
693</dt>
694<dd>
695<p>
696 Generate a diff using the "histogram diff" algorithm.
697</p>
698</dd>
699<dt class="hdlist1">
Junio C Hamano4c4b0122011-06-30 01:19:32700--stat[=&lt;width&gt;[,&lt;name-width&gt;[,&lt;count&gt;]]]
Junio C Hamano60f8aa82007-03-06 09:58:26701</dt>
702<dd>
703<p>
Junio C Hamanoaea9e6b2012-03-07 00:17:11704 Generate a diffstat. By default, as much space as necessary
705 will be used for the filename part, and the rest for the graph
706 part. Maximum width defaults to terminal width, or 80 columns
707 if not connected to a terminal, and can be overriden by
708 <tt>&lt;width&gt;</tt>. The width of the filename part can be limited by
709 giving another width <tt>&lt;name-width&gt;</tt> after a comma. The width
710 of the graph part can be limited by using
711 <tt>--stat-graph-width=&lt;width&gt;</tt> (affects all commands generating
712 a stat graph) or by setting <tt>diff.statGraphWidth=&lt;width&gt;</tt>
713 (does not affect <tt>git format-patch</tt>).
Junio C Hamano4c4b0122011-06-30 01:19:32714 By giving a third parameter <tt>&lt;count&gt;</tt>, you can limit the
Junio C Hamanob76a6862012-05-02 22:02:46715 output to the first <tt>&lt;count&gt;</tt> lines, followed by <tt>...</tt> if
Junio C Hamanoaea9e6b2012-03-07 00:17:11716 there are more.
Junio C Hamano60f8aa82007-03-06 09:58:26717</p>
Junio C Hamano4c4b0122011-06-30 01:19:32718<div class="paragraph"><p>These parameters can also be set individually with <tt>--stat-width=&lt;width&gt;</tt>,
719<tt>--stat-name-width=&lt;name-width&gt;</tt> and <tt>--stat-count=&lt;count&gt;</tt>.</p></div>
Junio C Hamano60f8aa82007-03-06 09:58:26720</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59721<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26722--numstat
723</dt>
724<dd>
725<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37726 Similar to <tt>--stat</tt>, but shows number of added and
Junio C Hamano60f8aa82007-03-06 09:58:26727 deleted lines in decimal notation and pathname without
728 abbreviation, to make it more machine friendly. For
729 binary files, outputs two <tt>-</tt> instead of saying
730 <tt>0 0</tt>.
731</p>
732</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59733<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26734--shortstat
735</dt>
736<dd>
737<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37738 Output only the last line of the <tt>--stat</tt> format containing total
Junio C Hamano60f8aa82007-03-06 09:58:26739 number of modified files, as well as number of added and deleted
740 lines.
741</p>
742</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59743<dt class="hdlist1">
Junio C Hamano1c222c52011-05-13 19:55:32744--dirstat[=&lt;param1,param2,&#8230;&gt;]
Junio C Hamano6a45be92008-04-22 08:19:03745</dt>
746<dd>
747<p>
Junio C Hamano1c222c52011-05-13 19:55:32748 Output the distribution of relative amount of changes for each
749 sub-directory. The behavior of <tt>--dirstat</tt> can be customized by
750 passing it a comma separated list of parameters.
751 The defaults are controlled by the <tt>diff.dirstat</tt> configuration
Junio C Hamanoa28a9202012-06-21 07:08:23752 variable (see <a href="git-config.html">git-config(1)</a>).
Junio C Hamano1c222c52011-05-13 19:55:32753 The following parameters are available:
Junio C Hamano6a45be92008-04-22 08:19:03754</p>
Junio C Hamano1c222c52011-05-13 19:55:32755<div class="dlist"><dl>
756<dt class="hdlist1">
757<tt>changes</tt>
758</dt>
759<dd>
760<p>
761 Compute the dirstat numbers by counting the lines that have been
762 removed from the source, or added to the destination. This ignores
763 the amount of pure code movements within a file. In other words,
764 rearranging lines in a file is not counted as much as other changes.
765 This is the default behavior when no parameter is given.
766</p>
Junio C Hamano6a45be92008-04-22 08:19:03767</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59768<dt class="hdlist1">
Junio C Hamano1c222c52011-05-13 19:55:32769<tt>lines</tt>
Junio C Hamanoa476efa2008-10-10 15:31:42770</dt>
771<dd>
772<p>
Junio C Hamano1c222c52011-05-13 19:55:32773 Compute the dirstat numbers by doing the regular line-based diff
774 analysis, and summing the removed/added line counts. (For binary
775 files, count 64-byte chunks instead, since binary files have no
776 natural concept of lines). This is a more expensive <tt>--dirstat</tt>
777 behavior than the <tt>changes</tt> behavior, but it does count rearranged
778 lines within a file as much as other changes. The resulting output
779 is consistent with what you get from the other <tt>--*stat</tt> options.
Junio C Hamanoa476efa2008-10-10 15:31:42780</p>
781</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59782<dt class="hdlist1">
Junio C Hamano1c222c52011-05-13 19:55:32783<tt>files</tt>
784</dt>
785<dd>
786<p>
787 Compute the dirstat numbers by counting the number of files changed.
788 Each changed file counts equally in the dirstat analysis. This is
789 the computationally cheapest <tt>--dirstat</tt> behavior, since it does
790 not have to look at the file contents at all.
791</p>
792</dd>
793<dt class="hdlist1">
794<tt>cumulative</tt>
795</dt>
796<dd>
797<p>
798 Count changes in a child directory for the parent directory as well.
799 Note that when using <tt>cumulative</tt>, the sum of the percentages
800 reported may exceed 100%. The default (non-cumulative) behavior can
801 be specified with the <tt>noncumulative</tt> parameter.
802</p>
803</dd>
804<dt class="hdlist1">
805&lt;limit&gt;
806</dt>
807<dd>
808<p>
809 An integer parameter specifies a cut-off percent (3% by default).
810 Directories contributing less than this percentage of the changes
811 are not shown in the output.
812</p>
813</dd>
814</dl></div>
815<div class="paragraph"><p>Example: The following will count changed files, while ignoring
816directories with less than 10% of the total amount of changed files,
817and accumulating child directory counts in the parent directories:
818<tt>--dirstat=files,10,cumulative</tt>.</p></div>
819</dd>
820<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26821--summary
822</dt>
823<dd>
824<p>
825 Output a condensed summary of extended header information
826 such as creations, renames and mode changes.
827</p>
828</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59829<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26830--no-renames
831</dt>
832<dd>
833<p>
834 Turn off rename detection, even when the configuration
835 file gives the default to do so.
836</p>
837</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59838<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26839--full-index
840</dt>
841<dd>
842<p>
Junio C Hamano5cf43ca2008-08-20 09:14:14843 Instead of the first handful of characters, show the full
844 pre- and post-image blob object names on the "index"
845 line when generating patch format output.
Junio C Hamano60f8aa82007-03-06 09:58:26846</p>
847</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59848<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26849--binary
850</dt>
851<dd>
852<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37853 In addition to <tt>--full-index</tt>, output a binary diff that
854 can be applied with <tt>git-apply</tt>.
Junio C Hamano60f8aa82007-03-06 09:58:26855</p>
856</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59857<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26858--abbrev[=&lt;n&gt;]
859</dt>
860<dd>
861<p>
862 Instead of showing the full 40-byte hexadecimal object
863 name in diff-raw format output and diff-tree header
Junio C Hamano6efe3022009-01-13 16:47:56864 lines, show only a partial prefix. This is
Junio C Hamano3b70d3c2009-11-21 17:37:37865 independent of the <tt>--full-index</tt> option above, which controls
Junio C Hamano60f8aa82007-03-06 09:58:26866 the diff-patch output format. Non default number of
Junio C Hamano3b70d3c2009-11-21 17:37:37867 digits can be specified with <tt>--abbrev=&lt;n&gt;</tt>.
Junio C Hamano60f8aa82007-03-06 09:58:26868</p>
869</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59870<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:14871-B[&lt;n&gt;][/&lt;m&gt;]
Junio C Hamano60f8aa82007-03-06 09:58:26872</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59873<dt class="hdlist1">
Junio C Hamano39c7a692010-10-27 06:08:54874--break-rewrites[=[&lt;n&gt;][/&lt;m&gt;]]
875</dt>
Junio C Hamano60f8aa82007-03-06 09:58:26876<dd>
877<p>
Junio C Hamanoe85e36f2010-08-10 05:30:14878 Break complete rewrite changes into pairs of delete and
879 create. This serves two purposes:
Junio C Hamano60f8aa82007-03-06 09:58:26880</p>
Junio C Hamano68cf15a2010-11-06 01:01:59881<div class="paragraph"><p>It affects the way a change that amounts to a total rewrite of a file
Junio C Hamanoe85e36f2010-08-10 05:30:14882not as a series of deletion and insertion mixed together with a very
883few lines that happen to match textually as the context, but as a
884single deletion of everything old followed by a single insertion of
885everything new, and the number <tt>m</tt> controls this aspect of the -B
886option (defaults to 60%). <tt>-B/70%</tt> specifies that less than 30% of the
887original should remain in the result for git to consider it a total
888rewrite (i.e. otherwise the resulting patch will be a series of
889deletion and insertion mixed together with context lines).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59890<div class="paragraph"><p>When used with -M, a totally-rewritten file is also considered as the
Junio C Hamanoe85e36f2010-08-10 05:30:14891source of a rename (usually -M only considers a file that disappeared
892as the source of a rename), and the number <tt>n</tt> controls this aspect of
893the -B option (defaults to 50%). <tt>-B20%</tt> specifies that a change with
Junio C Hamano68cf15a2010-11-06 01:01:59894addition and deletion compared to 20% or more of the file&#8217;s size are
Junio C Hamanoe85e36f2010-08-10 05:30:14895eligible for being picked up as a possible source of a rename to
896another file.</p></div>
Junio C Hamano60f8aa82007-03-06 09:58:26897</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59898<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:14899-M[&lt;n&gt;]
Junio C Hamano60f8aa82007-03-06 09:58:26900</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59901<dt class="hdlist1">
Junio C Hamano0d75e872010-12-17 06:57:26902--find-renames[=&lt;n&gt;]
Junio C Hamano39c7a692010-10-27 06:08:54903</dt>
Junio C Hamano60f8aa82007-03-06 09:58:26904<dd>
905<p>
906 Detect renames.
Junio C Hamano5f2627d2011-05-06 20:23:48907 If <tt>n</tt> is specified, it is a threshold on the similarity
Junio C Hamanoe85e36f2010-08-10 05:30:14908 index (i.e. amount of addition/deletions compared to the
Junio C Hamano68cf15a2010-11-06 01:01:59909 file&#8217;s size). For example, <tt>-M90%</tt> means git should consider a
Junio C Hamanoe85e36f2010-08-10 05:30:14910 delete/add pair to be a rename if more than 90% of the file
Junio C Hamano68cf15a2010-11-06 01:01:59911 hasn&#8217;t changed.
Junio C Hamano60f8aa82007-03-06 09:58:26912</p>
913</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59914<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:14915-C[&lt;n&gt;]
Junio C Hamano60f8aa82007-03-06 09:58:26916</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59917<dt class="hdlist1">
Junio C Hamano0d75e872010-12-17 06:57:26918--find-copies[=&lt;n&gt;]
Junio C Hamano39c7a692010-10-27 06:08:54919</dt>
Junio C Hamano60f8aa82007-03-06 09:58:26920<dd>
921<p>
Junio C Hamano16f98872007-06-12 16:09:14922 Detect copies as well as renames. See also <tt>--find-copies-harder</tt>.
Junio C Hamanoe85e36f2010-08-10 05:30:14923 If <tt>n</tt> is specified, it has the same meaning as for <tt>-M&lt;n&gt;</tt>.
Junio C Hamano60f8aa82007-03-06 09:58:26924</p>
925</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59926<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26927--find-copies-harder
928</dt>
929<dd>
930<p>
Junio C Hamano16f98872007-06-12 16:09:14931 For performance reasons, by default, <tt>-C</tt> option finds copies only
Junio C Hamano60f8aa82007-03-06 09:58:26932 if the original file of the copy was modified in the same
933 changeset. This flag makes the command
934 inspect unmodified files as candidates for the source of
935 copy. This is a very expensive operation for large
Junio C Hamano16f98872007-06-12 16:09:14936 projects, so use it with caution. Giving more than one
937 <tt>-C</tt> option has the same effect.
Junio C Hamano60f8aa82007-03-06 09:58:26938</p>
939</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59940<dt class="hdlist1">
Junio C Hamanob02377c2011-04-28 22:26:02941-D
942</dt>
943<dt class="hdlist1">
944--irreversible-delete
945</dt>
946<dd>
947<p>
948 Omit the preimage for deletes, i.e. print only the header but not
949 the diff between the preimage and <tt>/dev/null</tt>. The resulting patch
950 is not meant to be applied with <tt>patch</tt> nor <tt>git apply</tt>; this is
951 solely for people who want to just concentrate on reviewing the
952 text after the change. In addition, the output obviously lack
953 enough information to apply such a patch in reverse, even manually,
954 hence the name of the option.
955</p>
956<div class="paragraph"><p>When used together with <tt>-B</tt>, omit also the preimage in the deletion part
957of a delete/create pair.</p></div>
958</dd>
959<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26960-l&lt;num&gt;
961</dt>
962<dd>
963<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37964 The <tt>-M</tt> and <tt>-C</tt> options require O(n^2) processing time where n
Junio C Hamano60f8aa82007-03-06 09:58:26965 is the number of potential rename/copy targets. This
966 option prevents rename/copy detection from running if
967 the number of rename/copy targets exceeds the specified
968 number.
969</p>
970</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59971<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26972-O&lt;orderfile&gt;
973</dt>
974<dd>
975<p>
976 Output the patch in the order specified in the
977 &lt;orderfile&gt;, which has one shell glob pattern per line.
978</p>
979</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59980<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:22981-a
982</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59983<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26984--text
985</dt>
986<dd>
987<p>
988 Treat all files as text.
989</p>
990</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59991<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26992--ignore-space-at-eol
993</dt>
994<dd>
995<p>
Junio C Hamano3a702342007-12-12 21:34:02996 Ignore changes in whitespace at EOL.
Junio C Hamano60f8aa82007-03-06 09:58:26997</p>
998</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59999<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:221000-b
1001</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591002<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:261003--ignore-space-change
1004</dt>
1005<dd>
1006<p>
Junio C Hamano3a702342007-12-12 21:34:021007 Ignore changes in amount of whitespace. This ignores whitespace
1008 at line end, and considers all other sequences of one or
1009 more whitespace characters to be equivalent.
Junio C Hamano60f8aa82007-03-06 09:58:261010</p>
1011</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591012<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:221013-w
Junio C Hamano60f8aa82007-03-06 09:58:261014</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591015<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:261016--ignore-all-space
1017</dt>
1018<dd>
1019<p>
Junio C Hamano3a702342007-12-12 21:34:021020 Ignore whitespace when comparing lines. This ignores
1021 differences even if one line has whitespace where the other
Junio C Hamano60f8aa82007-03-06 09:58:261022 line has none.
1023</p>
1024</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591025<dt class="hdlist1">
Junio C Hamano1d40ee82009-01-07 10:14:161026--inter-hunk-context=&lt;lines&gt;
1027</dt>
1028<dd>
1029<p>
1030 Show the context between diff hunks, up to the specified number
1031 of lines, thereby fusing hunks that are close to each other.
1032</p>
1033</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591034<dt class="hdlist1">
Junio C Hamano11821ed2011-10-19 18:42:091035-W
1036</dt>
1037<dt class="hdlist1">
1038--function-context
1039</dt>
1040<dd>
1041<p>
1042 Show whole surrounding functions of changes.
1043</p>
1044</dd>
1045<dt class="hdlist1">
Junio C Hamanobb0f4042007-07-04 06:41:401046--ext-diff
1047</dt>
1048<dd>
1049<p>
1050 Allow an external diff helper to be executed. If you set an
Junio C Hamanoa28a9202012-06-21 07:08:231051 external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need
1052 to use this option with <a href="git-log.html">git-log(1)</a> and friends.
Junio C Hamanobb0f4042007-07-04 06:41:401053</p>
1054</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591055<dt class="hdlist1">
Junio C Hamanobb0f4042007-07-04 06:41:401056--no-ext-diff
1057</dt>
1058<dd>
1059<p>
1060 Disallow external diff drivers.
1061</p>
1062</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591063<dt class="hdlist1">
Junio C Hamanoc652aed2011-07-07 01:14:311064--textconv
1065</dt>
1066<dt class="hdlist1">
1067--no-textconv
1068</dt>
1069<dd>
1070<p>
1071 Allow (or disallow) external text conversion filters to be run
Junio C Hamanoa28a9202012-06-21 07:08:231072 when comparing binary files. See <a href="gitattributes.html">gitattributes(5)</a> for
Junio C Hamanoc652aed2011-07-07 01:14:311073 details. Because textconv filters are typically a one-way
1074 conversion, the resulting diff is suitable for human
1075 consumption, but cannot be applied. For this reason, textconv
Junio C Hamanoa28a9202012-06-21 07:08:231076 filters are enabled by default only for <a href="git-diff.html">git-diff(1)</a> and
1077 <a href="git-log.html">git-log(1)</a>, but not for <a href="git-format-patch.html">git-format-patch(1)</a> or
Junio C Hamanoc652aed2011-07-07 01:14:311078 diff plumbing commands.
1079</p>
1080</dd>
1081<dt class="hdlist1">
Junio C Hamano7d449522010-07-01 00:08:511082--ignore-submodules[=&lt;when&gt;]
Junio C Hamanodfccbb02008-05-26 01:16:141083</dt>
1084<dd>
1085<p>
Junio C Hamano7d449522010-07-01 00:08:511086 Ignore changes to submodules in the diff generation. &lt;when&gt; can be
Junio C Hamano619596a2010-08-18 22:15:351087 either "none", "untracked", "dirty" or "all", which is the default
1088 Using "none" will consider the submodule modified when it either contains
1089 untracked or modified files or its HEAD differs from the commit recorded
1090 in the superproject and can be used to override any settings of the
Junio C Hamanoa28a9202012-06-21 07:08:231091 <em>ignore</em> option in <a href="git-config.html">git-config(1)</a> or <a href="gitmodules.html">gitmodules(5)</a>. When
Junio C Hamano7d449522010-07-01 00:08:511092 "untracked" is used submodules are not considered dirty when they only
1093 contain untracked content (but they are still scanned for modified
1094 content). Using "dirty" ignores all changes to the work tree of submodules,
1095 only changes to the commits stored in the superproject are shown (this was
1096 the behavior until 1.7.0). Using "all" hides all changes to submodules.
Junio C Hamanodfccbb02008-05-26 01:16:141097</p>
1098</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591099<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331100--src-prefix=&lt;prefix&gt;
1101</dt>
1102<dd>
1103<p>
1104 Show the given source prefix instead of "a/".
1105</p>
1106</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591107<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331108--dst-prefix=&lt;prefix&gt;
1109</dt>
1110<dd>
1111<p>
1112 Show the given destination prefix instead of "b/".
1113</p>
1114</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591115<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331116--no-prefix
1117</dt>
1118<dd>
1119<p>
1120 Do not show any source or destination prefix.
1121</p>
1122</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311123</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:591124<div class="paragraph"><p>For more detailed explanation on these common options, see also
Junio C Hamanoa28a9202012-06-21 07:08:231125<a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591126<div class="dlist"><dl>
1127<dt class="hdlist1">
Junio C Hamanobb0f4042007-07-04 06:41:401128-&lt;n&gt;
1129</dt>
1130<dd>
1131<p>
Junio C Hamano3b4609d2010-09-30 00:04:341132 Prepare patches from the topmost &lt;n&gt; commits.
Junio C Hamanobb0f4042007-07-04 06:41:401133</p>
1134</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591135<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471136-o &lt;dir&gt;
1137</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591138<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471139--output-directory &lt;dir&gt;
Junio C Hamano1a4e8412005-12-27 08:17:231140</dt>
1141<dd>
1142<p>
1143 Use &lt;dir&gt; to store the resulting files, instead of the
Junio C Hamano1bab4b02006-06-06 21:58:331144 current working directory.
Junio C Hamano1a4e8412005-12-27 08:17:231145</p>
1146</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591147<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471148-n
1149</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591150<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471151--numbered
Junio C Hamano1a4e8412005-12-27 08:17:231152</dt>
1153<dd>
1154<p>
Junio C Hamano7d06a8a2008-10-20 05:42:331155 Name output in <em>[PATCH n/m]</em> format, even with a single patch.
Junio C Hamano1a4e8412005-12-27 08:17:231156</p>
1157</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591158<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471159-N
1160</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591161<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471162--no-numbered
Junio C Hamano8c5802d2007-11-15 00:13:361163</dt>
1164<dd>
1165<p>
1166 Name output in <em>[PATCH]</em> format.
1167</p>
1168</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591169<dt class="hdlist1">
Junio C Hamano341071d2006-06-04 07:24:481170--start-number &lt;n&gt;
1171</dt>
1172<dd>
1173<p>
1174 Start numbering the patches at &lt;n&gt; instead of 1.
1175</p>
1176</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591177<dt class="hdlist1">
Junio C Hamano94cad1a2007-06-06 10:48:251178--numbered-files
1179</dt>
1180<dd>
1181<p>
1182 Output file names will be a simple number sequence
1183 without the default first line of the commit appended.
Junio C Hamano94cad1a2007-06-06 10:48:251184</p>
1185</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591186<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471187-k
1188</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591189<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471190--keep-subject
Junio C Hamano1a4e8412005-12-27 08:17:231191</dt>
1192<dd>
1193<p>
1194 Do not strip/add <em>[PATCH]</em> from the first line of the
1195 commit log message.
1196</p>
1197</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591198<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471199-s
1200</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591201<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471202--signoff
Junio C Hamano1a4e8412005-12-27 08:17:231203</dt>
1204<dd>
1205<p>
1206 Add <tt>Signed-off-by:</tt> line to the commit message, using
1207 the committer identity of yourself.
1208</p>
1209</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591210<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231211--stdout
1212</dt>
1213<dd>
1214<p>
Junio C Hamano341071d2006-06-04 07:24:481215 Print all commits to the standard output in mbox format,
1216 instead of creating a file for each one.
Junio C Hamano1a4e8412005-12-27 08:17:231217</p>
1218</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591219<dt class="hdlist1">
Junio C Hamanoc51fede2007-03-12 07:29:201220--attach[=&lt;boundary&gt;]
Junio C Hamano2496ae42006-03-11 08:04:331221</dt>
1222<dd>
1223<p>
Junio C Hamanoc51fede2007-03-12 07:29:201224 Create multipart/mixed attachment, the first part of
1225 which is the commit message and the patch itself in the
Junio C Hamano3b70d3c2009-11-21 17:37:371226 second part, with <tt>Content-Disposition: attachment</tt>.
Junio C Hamanoc51fede2007-03-12 07:29:201227</p>
1228</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591229<dt class="hdlist1">
Junio C Hamano0a235222009-03-06 08:21:091230--no-attach
1231</dt>
1232<dd>
1233<p>
1234 Disable the creation of an attachment, overriding the
1235 configuration setting.
1236</p>
1237</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591238<dt class="hdlist1">
Junio C Hamanoc51fede2007-03-12 07:29:201239--inline[=&lt;boundary&gt;]
1240</dt>
1241<dd>
1242<p>
1243 Create multipart/mixed attachment, the first part of
1244 which is the commit message and the patch itself in the
Junio C Hamano3b70d3c2009-11-21 17:37:371245 second part, with <tt>Content-Disposition: inline</tt>.
Junio C Hamano2496ae42006-03-11 08:04:331246</p>
1247</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591248<dt class="hdlist1">
Junio C Hamanoea6a7642009-03-11 23:56:191249--thread[=&lt;style&gt;]
Junio C Hamanof9ca97d2006-07-25 22:23:091250</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591251<dt class="hdlist1">
Junio C Hamano1bbd0f42009-07-23 06:20:291252--no-thread
1253</dt>
Junio C Hamanof9ca97d2006-07-25 22:23:091254<dd>
1255<p>
Junio C Hamano3b70d3c2009-11-21 17:37:371256 Controls addition of <tt>In-Reply-To</tt> and <tt>References</tt> headers to
Junio C Hamano1bbd0f42009-07-23 06:20:291257 make the second and subsequent mails appear as replies to the
Junio C Hamano3b70d3c2009-11-21 17:37:371258 first. Also controls generation of the <tt>Message-Id</tt> header to
Junio C Hamano1bbd0f42009-07-23 06:20:291259 reference.
Junio C Hamanof9ca97d2006-07-25 22:23:091260</p>
Junio C Hamano68cf15a2010-11-06 01:01:591261<div class="paragraph"><p>The optional &lt;style&gt; argument can be either <tt>shallow</tt> or <tt>deep</tt>.
Junio C Hamanof4581102009-04-25 08:29:591262<em>shallow</em> threading makes every mail a reply to the head of the
Junio C Hamanoea6a7642009-03-11 23:56:191263series, where the head is chosen from the cover letter, the
Junio C Hamanof4581102009-04-25 08:29:591264<tt>--in-reply-to</tt>, and the first patch mail, in this order. <em>deep</em>
Junio C Hamano1bbd0f42009-07-23 06:20:291265threading makes every mail a reply to the previous one.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591266<div class="paragraph"><p>The default is <tt>--no-thread</tt>, unless the <em>format.thread</em> configuration
Junio C Hamano3b70d3c2009-11-21 17:37:371267is set. If <tt>--thread</tt> is specified without a style, it defaults to the
Junio C Hamano1bbd0f42009-07-23 06:20:291268style specified by <em>format.thread</em> if any, or else <tt>shallow</tt>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591269<div class="paragraph"><p>Beware that the default for <em>git send-email</em> is to thread emails
Junio C Hamano3b70d3c2009-11-21 17:37:371270itself. If you want <tt>git format-patch</tt> to take care of threading, you
1271will want to ensure that threading is disabled for <tt>git send-email</tt>.</p></div>
Junio C Hamanof9ca97d2006-07-25 22:23:091272</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591273<dt class="hdlist1">
Junio C Hamanof9ca97d2006-07-25 22:23:091274--in-reply-to=Message-Id
1275</dt>
1276<dd>
1277<p>
Junio C Hamano3b70d3c2009-11-21 17:37:371278 Make the first mail (or all the mails with <tt>--no-thread</tt>) appear as a
Junio C Hamanof9ca97d2006-07-25 22:23:091279 reply to the given Message-Id, which avoids breaking threads to
1280 provide a new patch series.
1281</p>
1282</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591283<dt class="hdlist1">
Junio C Hamano7c73c662007-01-19 00:37:501284--ignore-if-in-upstream
1285</dt>
1286<dd>
1287<p>
1288 Do not include a patch that matches a commit in
1289 &lt;until&gt;..&lt;since&gt;. This will examine all patches reachable
1290 from &lt;since&gt; but not from &lt;until&gt; and compare them with the
1291 patches being generated, and any patch that matches is
1292 ignored.
1293</p>
1294</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591295<dt class="hdlist1">
Junio C Hamano6f1cca82007-04-12 05:02:471296--subject-prefix=&lt;Subject-Prefix&gt;
1297</dt>
1298<dd>
1299<p>
1300 Instead of the standard <em>[PATCH]</em> prefix in the subject
1301 line, instead use <em>[&lt;Subject-Prefix&gt;]</em>. This
1302 allows for useful naming of a patch series, and can be
Junio C Hamano3b70d3c2009-11-21 17:37:371303 combined with the <tt>--numbered</tt> option.
Junio C Hamano6f1cca82007-04-12 05:02:471304</p>
1305</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591306<dt class="hdlist1">
Junio C Hamanoea90ab32010-03-15 20:32:551307--to=&lt;email&gt;
1308</dt>
1309<dd>
1310<p>
1311 Add a <tt>To:</tt> header to the email headers. This is in addition
1312 to any configured headers, and may be used multiple times.
Junio C Hamano7bd050f2011-09-22 06:32:221313 The negated form <tt>--no-to</tt> discards all <tt>To:</tt> headers added so
1314 far (from config or command line).
Junio C Hamanoea90ab32010-03-15 20:32:551315</p>
1316</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591317<dt class="hdlist1">
Junio C Hamano24bc09a2008-02-28 00:27:441318--cc=&lt;email&gt;
1319</dt>
1320<dd>
1321<p>
Junio C Hamano3b70d3c2009-11-21 17:37:371322 Add a <tt>Cc:</tt> header to the email headers. This is in addition
Junio C Hamano24bc09a2008-02-28 00:27:441323 to any configured headers, and may be used multiple times.
Junio C Hamano7bd050f2011-09-22 06:32:221324 The negated form <tt>--no-cc</tt> discards all <tt>Cc:</tt> headers added so
1325 far (from config or command line).
Junio C Hamano24bc09a2008-02-28 00:27:441326</p>
1327</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591328<dt class="hdlist1">
Junio C Hamano9572e922009-04-02 06:52:031329--add-header=&lt;header&gt;
1330</dt>
1331<dd>
1332<p>
1333 Add an arbitrary header to the email headers. This is in addition
1334 to any configured headers, and may be used multiple times.
Junio C Hamano7bd050f2011-09-22 06:32:221335 For example, <tt>--add-header="Organization: git-foo"</tt>.
1336 The negated form <tt>--no-add-header</tt> discards <strong>all</strong> (<tt>To:</tt>,
1337 <tt>Cc:</tt>, and custom) headers added so far from config or command
1338 line.
Junio C Hamano9572e922009-04-02 06:52:031339</p>
1340</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591341<dt class="hdlist1">
Junio C Hamano24bc09a2008-02-28 00:27:441342--cover-letter
1343</dt>
1344<dd>
1345<p>
Junio C Hamano92a4abd2008-08-15 05:34:441346 In addition to the patches, generate a cover letter file
1347 containing the shortlog and the overall diffstat. You can
1348 fill in a description in the file before sending it out.
Junio C Hamano24bc09a2008-02-28 00:27:441349</p>
1350</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591351<dt class="hdlist1">
Junio C Hamano89a57342010-06-22 23:22:551352--[no]-signature=&lt;signature&gt;
1353</dt>
1354<dd>
1355<p>
1356 Add a signature to each message produced. Per RFC 3676 the signature
Junio C Hamano68cf15a2010-11-06 01:01:591357 is separated from the body by a line with '-- ' on it. If the
Junio C Hamano89a57342010-06-22 23:22:551358 signature option is omitted the signature defaults to the git version
1359 number.
1360</p>
1361</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591362<dt class="hdlist1">
Junio C Hamano4f9a6052007-01-17 20:25:161363--suffix=.&lt;sfx&gt;
1364</dt>
1365<dd>
1366<p>
Junio C Hamano7c73c662007-01-19 00:37:501367 Instead of using <tt>.patch</tt> as the suffix for generated
Junio C Hamanoa6387422007-08-25 03:54:271368 filenames, use specified suffix. A common alternative is
Junio C Hamanof4581102009-04-25 08:29:591369 <tt>--suffix=.txt</tt>. Leaving this empty will remove the <tt>.patch</tt>
1370 suffix.
Junio C Hamano4f9a6052007-01-17 20:25:161371</p>
Junio C Hamano68cf15a2010-11-06 01:01:591372<div class="paragraph"><p>Note that the leading character does not have to be a dot; for example,
Junio C Hamanof4581102009-04-25 08:29:591373you can use <tt>--suffix=-patch</tt> to get <tt>0001-description-of-my-change-patch</tt>.</p></div>
Junio C Hamano4f9a6052007-01-17 20:25:161374</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591375<dt class="hdlist1">
Junio C Hamano209ebe82011-04-27 21:09:591376--quiet
1377</dt>
1378<dd>
1379<p>
1380 Do not print the names of the generated files to standard output.
1381</p>
1382</dd>
1383<dt class="hdlist1">
Junio C Hamano869bb802008-05-12 00:29:471384--no-binary
1385</dt>
1386<dd>
1387<p>
Junio C Hamanof4581102009-04-25 08:29:591388 Do not output contents of changes in binary files, instead
1389 display a notice that those files changed. Patches generated
1390 using this option cannot be applied properly, but they are
1391 still useful for code review.
Junio C Hamano869bb802008-05-12 00:29:471392</p>
1393</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591394<dt class="hdlist1">
Junio C Hamano9572e922009-04-02 06:52:031395--root
1396</dt>
1397<dd>
1398<p>
1399 Treat the revision argument as a &lt;revision range&gt;, even if it
1400 is just a single commit (that would normally be treated as a
1401 &lt;since&gt;). Note that root commits included in the specified
1402 range are always formatted as creation patches, independently
1403 of this flag.
1404</p>
1405</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311406</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:231407</div>
Junio C Hamanoba4b9282008-07-06 05:20:311408<h2 id="_configuration">CONFIGURATION</h2>
Junio C Hamano2496ae42006-03-11 08:04:331409<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591410<div class="paragraph"><p>You can specify extra mail header lines to be added to each message,
Junio C Hamanof4581102009-04-25 08:29:591411defaults for the subject prefix and file suffix, number patches when
Junio C Hamanoea90ab32010-03-15 20:32:551412outputting more than one patch, add "To" or "Cc:" headers, configure
1413attachments, and sign off patches with configuration variables.</p></div>
Junio C Hamano7c73c662007-01-19 00:37:501414<div class="listingblock">
Junio C Hamano2496ae42006-03-11 08:04:331415<div class="content">
Junio C Hamano7c73c662007-01-19 00:37:501416<pre><tt>[format]
1417 headers = "Organization: git-foo\n"
Junio C Hamano1d90cb02007-07-03 07:05:311418 subjectprefix = CHANGE
Junio C Hamano8c5802d2007-11-15 00:13:361419 suffix = .txt
Junio C Hamano2fbcd212008-05-14 22:26:071420 numbered = auto
Junio C Hamanoea90ab32010-03-15 20:32:551421 to = &lt;email&gt;
Junio C Hamano0a235222009-03-06 08:21:091422 cc = &lt;email&gt;
Junio C Hamano5f9a6f02009-04-06 08:26:561423 attach [ = mime-boundary-string ]
1424 signoff = true</tt></pre>
Junio C Hamano4f9a6052007-01-17 20:25:161425</div></div>
Junio C Hamano2496ae42006-03-11 08:04:331426</div>
Junio C Hamanob77f8192011-05-05 01:30:381427<h2 id="_discussion">DISCUSSION</h2>
1428<div class="sectionbody">
1429<div class="paragraph"><p>The patch produced by <em>git format-patch</em> is in UNIX mailbox format,
1430with a fixed "magic" time stamp to indicate that the file is output
1431from format-patch rather than a real mailbox, like so:</p></div>
1432<div class="listingblock">
1433<div class="content">
1434<pre><tt>From 8f72bad1baf19a53459661343e21d6491c3908d3 Mon Sep 17 00:00:00 2001
1435From: Tony Luck &lt;tony.luck@intel.com&gt;
1436Date: Tue, 13 Jul 2010 11:42:54 -0700
1437Subject: [PATCH] =?UTF-8?q?[IA64]=20Put=20ia64=20config=20files=20on=20the=20?=
1438 =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig=20diet?=
1439MIME-Version: 1.0
1440Content-Type: text/plain; charset=UTF-8
1441Content-Transfer-Encoding: 8bit
1442
1443arch/arm config files were slimmed down using a python script
1444(See commit c2330e286f68f1c408b4aa6515ba49d57f05beae comment)
1445
1446Do the same for ia64 so we can have sleek &amp; trim looking
1447...</tt></pre>
1448</div></div>
1449<div class="paragraph"><p>Typically it will be placed in a MUA&#8217;s drafts folder, edited to add
1450timely commentary that should not go in the changelog after the three
1451dashes, and then sent as a message whose body, in our example, starts
1452with "arch/arm config files were&#8230;". On the receiving end, readers
1453can save interesting patches in a UNIX mailbox and apply them with
Junio C Hamanoa28a9202012-06-21 07:08:231454<a href="git-am.html">git-am(1)</a>.</p></div>
Junio C Hamanob77f8192011-05-05 01:30:381455<div class="paragraph"><p>When a patch is part of an ongoing discussion, the patch generated by
1456<em>git format-patch</em> can be tweaked to take advantage of the <em>git am
1457--scissors</em> feature. After your response to the discussion comes a
1458line that consists solely of "<tt>-- &gt;8 --</tt>" (scissors and perforation),
1459followed by the patch with unnecessary header fields removed:</p></div>
1460<div class="listingblock">
1461<div class="content">
1462<pre><tt>...
1463&gt; So we should do such-and-such.
1464
1465Makes sense to me. How about this patch?
1466
1467-- &gt;8 --
1468Subject: [IA64] Put ia64 config files on the Uwe Kleine-König diet
1469
1470arch/arm config files were slimmed down using a python script
1471...</tt></pre>
1472</div></div>
1473<div class="paragraph"><p>When sending a patch this way, most often you are sending your own
1474patch, so in addition to the "<tt>From $SHA1 $magic_timestamp</tt>" marker you
1475should omit <tt>From:</tt> and <tt>Date:</tt> lines from the patch file. The patch
1476title is likely to be different from the subject of the discussion the
1477patch is in response to, so it is likely that you would want to keep
1478the Subject: line, like the example above.</p></div>
1479<h3 id="_checking_for_patch_corruption">Checking for patch corruption</h3><div style="clear:left"></div>
1480<div class="paragraph"><p>Many mailers if not set up properly will corrupt whitespace. Here are
1481two common types of corruption:</p></div>
1482<div class="ulist"><ul>
1483<li>
1484<p>
1485Empty context lines that do not have <em>any</em> whitespace.
1486</p>
1487</li>
1488<li>
1489<p>
1490Non-empty context lines that have one extra whitespace at the
1491 beginning.
1492</p>
1493</li>
1494</ul></div>
1495<div class="paragraph"><p>One way to test if your MUA is set up correctly is:</p></div>
1496<div class="ulist"><ul>
1497<li>
1498<p>
1499Send the patch to yourself, exactly the way you would, except
1500 with To: and Cc: lines that do not contain the list and
1501 maintainer address.
1502</p>
1503</li>
1504<li>
1505<p>
1506Save that patch to a file in UNIX mailbox format. Call it a.patch,
1507 say.
1508</p>
1509</li>
1510<li>
1511<p>
1512Apply it:
1513</p>
1514<div class="literalblock">
1515<div class="content">
1516<pre><tt>$ git fetch &lt;project&gt; master:test-apply
1517$ git checkout test-apply
1518$ git reset --hard
1519$ git am a.patch</tt></pre>
1520</div></div>
1521</li>
1522</ul></div>
1523<div class="paragraph"><p>If it does not apply correctly, there can be various reasons.</p></div>
1524<div class="ulist"><ul>
1525<li>
1526<p>
1527The patch itself does not apply cleanly. That is <em>bad</em> but
1528 does not have much to do with your MUA. You might want to rebase
Junio C Hamanoa28a9202012-06-21 07:08:231529 the patch with <a href="git-rebase.html">git-rebase(1)</a> before regenerating it in
Junio C Hamanob77f8192011-05-05 01:30:381530 this case.
1531</p>
1532</li>
1533<li>
1534<p>
1535The MUA corrupted your patch; "am" would complain that
1536 the patch does not apply. Look in the .git/rebase-apply/ subdirectory and
1537 see what <em>patch</em> file contains and check for the common
1538 corruption patterns mentioned above.
1539</p>
1540</li>
1541<li>
1542<p>
1543While at it, check the <em>info</em> and <em>final-commit</em> files as well.
1544 If what is in <em>final-commit</em> is not exactly what you would want to
1545 see in the commit log message, it is very likely that the
1546 receiver would end up hand editing the log message when applying
1547 your patch. Things like "Hi, this is my first patch.\n" in the
1548 patch e-mail should come after the three-dash line that signals
1549 the end of the commit message.
1550</p>
1551</li>
1552</ul></div>
1553</div>
1554<h2 id="_mua_specific_hints">MUA-SPECIFIC HINTS</h2>
1555<div class="sectionbody">
1556<div class="paragraph"><p>Here are some hints on how to successfully submit patches inline using
1557various mailers.</p></div>
1558<h3 id="_gmail">GMail</h3><div style="clear:left"></div>
1559<div class="paragraph"><p>GMail does not have any way to turn off line wrapping in the web
1560interface, so it will mangle any emails that you send. You can however
1561use "git send-email" and send your patches through the GMail SMTP server, or
1562use any IMAP email client to connect to the google IMAP server and forward
1563the emails through that.</p></div>
1564<div class="paragraph"><p>For hints on using <em>git send-email</em> to send your patches through the
Junio C Hamanoa28a9202012-06-21 07:08:231565GMail SMTP server, see the EXAMPLE section of <a href="git-send-email.html">git-send-email(1)</a>.</p></div>
Junio C Hamanob77f8192011-05-05 01:30:381566<div class="paragraph"><p>For hints on submission using the IMAP interface, see the EXAMPLE
Junio C Hamanoa28a9202012-06-21 07:08:231567section of <a href="git-imap-send.html">git-imap-send(1)</a>.</p></div>
Junio C Hamanob77f8192011-05-05 01:30:381568<h3 id="_thunderbird">Thunderbird</h3><div style="clear:left"></div>
1569<div class="paragraph"><p>By default, Thunderbird will both wrap emails as well as flag
1570them as being <em>format=flowed</em>, both of which will make the
1571resulting email unusable by git.</p></div>
1572<div class="paragraph"><p>There are three different approaches: use an add-on to turn off line wraps,
1573configure Thunderbird to not mangle patches, or use
1574an external editor to keep Thunderbird from mangling the patches.</p></div>
1575<h4 id="_approach_1_add_on">Approach #1 (add-on)</h4>
1576<div class="paragraph"><p>Install the Toggle Word Wrap add-on that is available from
1577<a href="https://addons.mozilla.org/thunderbird/addon/toggle-word-wrap/">https://addons.mozilla.org/thunderbird/addon/toggle-word-wrap/</a>
1578It adds a menu entry "Enable Word Wrap" in the composer&#8217;s "Options" menu
1579that you can tick off. Now you can compose the message as you otherwise do
1580(cut + paste, <em>git format-patch</em> | <em>git imap-send</em>, etc), but you have to
1581insert line breaks manually in any text that you type.</p></div>
1582<h4 id="_approach_2_configuration">Approach #2 (configuration)</h4>
1583<div class="paragraph"><p>Three steps:</p></div>
1584<div class="olist arabic"><ol class="arabic">
1585<li>
1586<p>
1587Configure your mail server composition as plain text:
1588 Edit&#8230;Account Settings&#8230;Composition &amp; Addressing,
1589 uncheck "Compose Messages in HTML".
1590</p>
1591</li>
1592<li>
1593<p>
1594Configure your general composition window to not wrap.
1595</p>
1596<div class="paragraph"><p>In Thunderbird 2:
1597Edit..Preferences..Composition, wrap plain text messages at 0</p></div>
1598<div class="paragraph"><p>In Thunderbird 3:
1599Edit..Preferences..Advanced..Config Editor. Search for
1600"mail.wrap_long_lines".
1601Toggle it to make sure it is set to <tt>false</tt>.</p></div>
1602</li>
1603<li>
1604<p>
1605Disable the use of format=flowed:
1606Edit..Preferences..Advanced..Config Editor. Search for
1607"mailnews.send_plaintext_flowed".
1608Toggle it to make sure it is set to <tt>false</tt>.
1609</p>
1610</li>
1611</ol></div>
1612<div class="paragraph"><p>After that is done, you should be able to compose email as you
1613otherwise would (cut + paste, <em>git format-patch</em> | <em>git imap-send</em>, etc),
1614and the patches will not be mangled.</p></div>
1615<h4 id="_approach_3_external_editor">Approach #3 (external editor)</h4>
1616<div class="paragraph"><p>The following Thunderbird extensions are needed:
1617AboutConfig from <a href="http://aboutconfig.mozdev.org/">http://aboutconfig.mozdev.org/</a> and
1618External Editor from <a href="http://globs.org/articles.php?lng=en&amp;pg=8">http://globs.org/articles.php?lng=en&amp;pg=8</a></p></div>
1619<div class="olist arabic"><ol class="arabic">
1620<li>
1621<p>
1622Prepare the patch as a text file using your method of choice.
1623</p>
1624</li>
1625<li>
1626<p>
1627Before opening a compose window, use Edit&#8594;Account Settings to
1628 uncheck the "Compose messages in HTML format" setting in the
1629 "Composition &amp; Addressing" panel of the account to be used to
1630 send the patch.
1631</p>
1632</li>
1633<li>
1634<p>
1635In the main Thunderbird window, <em>before</em> you open the compose
1636 window for the patch, use Tools&#8594;about:config to set the
1637 following to the indicated values:
1638</p>
1639<div class="listingblock">
1640<div class="content">
1641<pre><tt> mailnews.send_plaintext_flowed =&gt; false
1642 mailnews.wraplength =&gt; 0</tt></pre>
1643</div></div>
1644</li>
1645<li>
1646<p>
1647Open a compose window and click the external editor icon.
1648</p>
1649</li>
1650<li>
1651<p>
1652In the external editor window, read in the patch file and exit
1653 the editor normally.
1654</p>
1655</li>
1656</ol></div>
1657<div class="paragraph"><p>Side note: it may be possible to do step 2 with
1658about:config and the following settings but no one&#8217;s tried yet.</p></div>
1659<div class="listingblock">
1660<div class="content">
1661<pre><tt> mail.html_compose =&gt; false
1662 mail.identity.default.compose_html =&gt; false
1663 mail.identity.id?.compose_html =&gt; false</tt></pre>
1664</div></div>
1665<div class="paragraph"><p>There is a script in contrib/thunderbird-patch-inline which can help
1666you include patches with Thunderbird in an easy way. To use it, do the
1667steps above and then use the script as the external editor.</p></div>
1668<h3 id="_kmail">KMail</h3><div style="clear:left"></div>
1669<div class="paragraph"><p>This should help you to submit patches inline using KMail.</p></div>
1670<div class="olist arabic"><ol class="arabic">
1671<li>
1672<p>
1673Prepare the patch as a text file.
1674</p>
1675</li>
1676<li>
1677<p>
1678Click on New Mail.
1679</p>
1680</li>
1681<li>
1682<p>
1683Go under "Options" in the Composer window and be sure that
1684 "Word wrap" is not set.
1685</p>
1686</li>
1687<li>
1688<p>
1689Use Message &#8594; Insert file&#8230; and insert the patch.
1690</p>
1691</li>
1692<li>
1693<p>
1694Back in the compose window: add whatever other text you wish to the
1695 message, complete the addressing and subject fields, and press send.
1696</p>
1697</li>
1698</ol></div>
1699</div>
Junio C Hamanoba4b9282008-07-06 05:20:311700<h2 id="_examples">EXAMPLES</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231701<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591702<div class="ulist"><ul>
Junio C Hamano6d76d612008-05-09 05:46:081703<li>
Junio C Hamano1a4e8412005-12-27 08:17:231704<p>
Junio C Hamano6d76d612008-05-09 05:46:081705Extract commits between revisions R1 and R2, and apply them on top of
Junio C Hamano1aa40d22010-01-21 17:46:431706the current branch using <em>git am</em> to cherry-pick them:
Junio C Hamano1a4e8412005-12-27 08:17:231707</p>
Junio C Hamano6d76d612008-05-09 05:46:081708<div class="listingblock">
1709<div class="content">
Junio C Hamanoba4b9282008-07-06 05:20:311710<pre><tt>$ git format-patch -k --stdout R1..R2 | git am -3 -k</tt></pre>
Junio C Hamano6d76d612008-05-09 05:46:081711</div></div>
1712</li>
1713<li>
Junio C Hamano1a4e8412005-12-27 08:17:231714<p>
Junio C Hamano6d76d612008-05-09 05:46:081715Extract all commits which are in the current branch but not in the
1716origin branch:
Junio C Hamano1a4e8412005-12-27 08:17:231717</p>
Junio C Hamano6d76d612008-05-09 05:46:081718<div class="listingblock">
1719<div class="content">
1720<pre><tt>$ git format-patch origin</tt></pre>
1721</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591722<div class="paragraph"><p>For each commit a separate file is created in the current directory.</p></div>
Junio C Hamano6d76d612008-05-09 05:46:081723</li>
1724<li>
Junio C Hamano7d9e9bd2007-08-29 07:31:471725<p>
Junio C Hamano6d76d612008-05-09 05:46:081726Extract all commits that lead to <em>origin</em> since the inception of the
1727project:
Junio C Hamano7d9e9bd2007-08-29 07:31:471728</p>
Junio C Hamano6d76d612008-05-09 05:46:081729<div class="listingblock">
1730<div class="content">
Junio C Hamanoba4b9282008-07-06 05:20:311731<pre><tt>$ git format-patch --root origin</tt></pre>
Junio C Hamano6d76d612008-05-09 05:46:081732</div></div>
1733</li>
1734<li>
Junio C Hamano1a4e8412005-12-27 08:17:231735<p>
Junio C Hamano6d76d612008-05-09 05:46:081736The same as the previous one:
Junio C Hamano1a4e8412005-12-27 08:17:231737</p>
Junio C Hamano6d76d612008-05-09 05:46:081738<div class="listingblock">
1739<div class="content">
1740<pre><tt>$ git format-patch -M -B origin</tt></pre>
1741</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591742<div class="paragraph"><p>Additionally, it detects and handles renames and complete rewrites
Junio C Hamano6d76d612008-05-09 05:46:081743intelligently to produce a renaming patch. A renaming patch reduces
Junio C Hamanof4581102009-04-25 08:29:591744the amount of text output, and generally makes it easier to review.
Junio C Hamano68cf15a2010-11-06 01:01:591745Note that non-git "patch" programs won&#8217;t understand renaming patches, so
Junio C Hamanoba4b9282008-07-06 05:20:311746use it only when you know the recipient uses git to apply your patch.</p></div>
Junio C Hamano6d76d612008-05-09 05:46:081747</li>
1748<li>
Junio C Hamano7c73c662007-01-19 00:37:501749<p>
Junio C Hamano6d76d612008-05-09 05:46:081750Extract three topmost commits from the current branch and format them
1751as e-mailable patches:
Junio C Hamano7c73c662007-01-19 00:37:501752</p>
Junio C Hamano6d76d612008-05-09 05:46:081753<div class="listingblock">
1754<div class="content">
1755<pre><tt>$ git format-patch -3</tt></pre>
1756</div></div>
1757</li>
Junio C Hamanoba4b9282008-07-06 05:20:311758</ul></div>
Junio C Hamano1a4e8412005-12-27 08:17:231759</div>
Junio C Hamanoba4b9282008-07-06 05:20:311760<h2 id="_see_also">SEE ALSO</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231761<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:231762<div class="paragraph"><p><a href="git-am.html">git-am(1)</a>, <a href="git-send-email.html">git-send-email(1)</a></p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231763</div>
Junio C Hamanoba4b9282008-07-06 05:20:311764<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231765<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:231766<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231767</div>
Junio C Hamano7bd050f2011-09-22 06:32:221768</div>
1769<div id="footnotes"><hr /></div>
Junio C Hamano1a4e8412005-12-27 08:17:231770<div id="footer">
1771<div id="footer-text">
Junio C Hamanob76a6862012-05-02 22:02:461772Last updated 2012-05-02 15:00:44 PDT
Junio C Hamano1a4e8412005-12-27 08:17:231773</div>
1774</div>
1775</body>
1776</html>