blob: cdc3867067314003c93d014d95295994635d01e8 [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 Hamanoc27b7332010-10-14 04:37:28621 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 Hamano4c4b0122011-06-30 01:19:32692--stat[=&lt;width&gt;[,&lt;name-width&gt;[,&lt;count&gt;]]]
Junio C Hamano60f8aa82007-03-06 09:58:26693</dt>
694<dd>
695<p>
696 Generate a diffstat. You can override the default
Junio C Hamanod2179ef2010-10-22 04:12:17697 output width for 80-column terminal by <tt>--stat=&lt;width&gt;</tt>.
Junio C Hamano60f8aa82007-03-06 09:58:26698 The width of the filename part can be controlled by
699 giving another width to it separated by a comma.
Junio C Hamano4c4b0122011-06-30 01:19:32700 By giving a third parameter <tt>&lt;count&gt;</tt>, you can limit the
701 output to the first <tt>&lt;count&gt;</tt> lines, followed by
702 <tt>&#8230;</tt> if there are more.
Junio C Hamano60f8aa82007-03-06 09:58:26703</p>
Junio C Hamano4c4b0122011-06-30 01:19:32704<div class="paragraph"><p>These parameters can also be set individually with <tt>--stat-width=&lt;width&gt;</tt>,
705<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:26706</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59707<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26708--numstat
709</dt>
710<dd>
711<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37712 Similar to <tt>--stat</tt>, but shows number of added and
Junio C Hamano60f8aa82007-03-06 09:58:26713 deleted lines in decimal notation and pathname without
714 abbreviation, to make it more machine friendly. For
715 binary files, outputs two <tt>-</tt> instead of saying
716 <tt>0 0</tt>.
717</p>
718</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59719<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26720--shortstat
721</dt>
722<dd>
723<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37724 Output only the last line of the <tt>--stat</tt> format containing total
Junio C Hamano60f8aa82007-03-06 09:58:26725 number of modified files, as well as number of added and deleted
726 lines.
727</p>
728</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59729<dt class="hdlist1">
Junio C Hamano1c222c52011-05-13 19:55:32730--dirstat[=&lt;param1,param2,&#8230;&gt;]
Junio C Hamano6a45be92008-04-22 08:19:03731</dt>
732<dd>
733<p>
Junio C Hamano1c222c52011-05-13 19:55:32734 Output the distribution of relative amount of changes for each
735 sub-directory. The behavior of <tt>--dirstat</tt> can be customized by
736 passing it a comma separated list of parameters.
737 The defaults are controlled by the <tt>diff.dirstat</tt> configuration
738 variable (see <a href="git-config.html">git-config(1)</a>).
739 The following parameters are available:
Junio C Hamano6a45be92008-04-22 08:19:03740</p>
Junio C Hamano1c222c52011-05-13 19:55:32741<div class="dlist"><dl>
742<dt class="hdlist1">
743<tt>changes</tt>
744</dt>
745<dd>
746<p>
747 Compute the dirstat numbers by counting the lines that have been
748 removed from the source, or added to the destination. This ignores
749 the amount of pure code movements within a file. In other words,
750 rearranging lines in a file is not counted as much as other changes.
751 This is the default behavior when no parameter is given.
752</p>
Junio C Hamano6a45be92008-04-22 08:19:03753</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59754<dt class="hdlist1">
Junio C Hamano1c222c52011-05-13 19:55:32755<tt>lines</tt>
Junio C Hamanoa476efa2008-10-10 15:31:42756</dt>
757<dd>
758<p>
Junio C Hamano1c222c52011-05-13 19:55:32759 Compute the dirstat numbers by doing the regular line-based diff
760 analysis, and summing the removed/added line counts. (For binary
761 files, count 64-byte chunks instead, since binary files have no
762 natural concept of lines). This is a more expensive <tt>--dirstat</tt>
763 behavior than the <tt>changes</tt> behavior, but it does count rearranged
764 lines within a file as much as other changes. The resulting output
765 is consistent with what you get from the other <tt>--*stat</tt> options.
Junio C Hamanoa476efa2008-10-10 15:31:42766</p>
767</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59768<dt class="hdlist1">
Junio C Hamano1c222c52011-05-13 19:55:32769<tt>files</tt>
770</dt>
771<dd>
772<p>
773 Compute the dirstat numbers by counting the number of files changed.
774 Each changed file counts equally in the dirstat analysis. This is
775 the computationally cheapest <tt>--dirstat</tt> behavior, since it does
776 not have to look at the file contents at all.
777</p>
778</dd>
779<dt class="hdlist1">
780<tt>cumulative</tt>
781</dt>
782<dd>
783<p>
784 Count changes in a child directory for the parent directory as well.
785 Note that when using <tt>cumulative</tt>, the sum of the percentages
786 reported may exceed 100%. The default (non-cumulative) behavior can
787 be specified with the <tt>noncumulative</tt> parameter.
788</p>
789</dd>
790<dt class="hdlist1">
791&lt;limit&gt;
792</dt>
793<dd>
794<p>
795 An integer parameter specifies a cut-off percent (3% by default).
796 Directories contributing less than this percentage of the changes
797 are not shown in the output.
798</p>
799</dd>
800</dl></div>
801<div class="paragraph"><p>Example: The following will count changed files, while ignoring
802directories with less than 10% of the total amount of changed files,
803and accumulating child directory counts in the parent directories:
804<tt>--dirstat=files,10,cumulative</tt>.</p></div>
805</dd>
806<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26807--summary
808</dt>
809<dd>
810<p>
811 Output a condensed summary of extended header information
812 such as creations, renames and mode changes.
813</p>
814</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59815<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26816--no-renames
817</dt>
818<dd>
819<p>
820 Turn off rename detection, even when the configuration
821 file gives the default to do so.
822</p>
823</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59824<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26825--full-index
826</dt>
827<dd>
828<p>
Junio C Hamano5cf43ca2008-08-20 09:14:14829 Instead of the first handful of characters, show the full
830 pre- and post-image blob object names on the "index"
831 line when generating patch format output.
Junio C Hamano60f8aa82007-03-06 09:58:26832</p>
833</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59834<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26835--binary
836</dt>
837<dd>
838<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37839 In addition to <tt>--full-index</tt>, output a binary diff that
840 can be applied with <tt>git-apply</tt>.
Junio C Hamano60f8aa82007-03-06 09:58:26841</p>
842</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59843<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26844--abbrev[=&lt;n&gt;]
845</dt>
846<dd>
847<p>
848 Instead of showing the full 40-byte hexadecimal object
849 name in diff-raw format output and diff-tree header
Junio C Hamano6efe3022009-01-13 16:47:56850 lines, show only a partial prefix. This is
Junio C Hamano3b70d3c2009-11-21 17:37:37851 independent of the <tt>--full-index</tt> option above, which controls
Junio C Hamano60f8aa82007-03-06 09:58:26852 the diff-patch output format. Non default number of
Junio C Hamano3b70d3c2009-11-21 17:37:37853 digits can be specified with <tt>--abbrev=&lt;n&gt;</tt>.
Junio C Hamano60f8aa82007-03-06 09:58:26854</p>
855</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59856<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:14857-B[&lt;n&gt;][/&lt;m&gt;]
Junio C Hamano60f8aa82007-03-06 09:58:26858</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59859<dt class="hdlist1">
Junio C Hamano39c7a692010-10-27 06:08:54860--break-rewrites[=[&lt;n&gt;][/&lt;m&gt;]]
861</dt>
Junio C Hamano60f8aa82007-03-06 09:58:26862<dd>
863<p>
Junio C Hamanoe85e36f2010-08-10 05:30:14864 Break complete rewrite changes into pairs of delete and
865 create. This serves two purposes:
Junio C Hamano60f8aa82007-03-06 09:58:26866</p>
Junio C Hamano68cf15a2010-11-06 01:01:59867<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:14868not as a series of deletion and insertion mixed together with a very
869few lines that happen to match textually as the context, but as a
870single deletion of everything old followed by a single insertion of
871everything new, and the number <tt>m</tt> controls this aspect of the -B
872option (defaults to 60%). <tt>-B/70%</tt> specifies that less than 30% of the
873original should remain in the result for git to consider it a total
874rewrite (i.e. otherwise the resulting patch will be a series of
875deletion and insertion mixed together with context lines).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59876<div class="paragraph"><p>When used with -M, a totally-rewritten file is also considered as the
Junio C Hamanoe85e36f2010-08-10 05:30:14877source of a rename (usually -M only considers a file that disappeared
878as the source of a rename), and the number <tt>n</tt> controls this aspect of
879the -B option (defaults to 50%). <tt>-B20%</tt> specifies that a change with
Junio C Hamano68cf15a2010-11-06 01:01:59880addition and deletion compared to 20% or more of the file&#8217;s size are
Junio C Hamanoe85e36f2010-08-10 05:30:14881eligible for being picked up as a possible source of a rename to
882another file.</p></div>
Junio C Hamano60f8aa82007-03-06 09:58:26883</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59884<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:14885-M[&lt;n&gt;]
Junio C Hamano60f8aa82007-03-06 09:58:26886</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59887<dt class="hdlist1">
Junio C Hamano0d75e872010-12-17 06:57:26888--find-renames[=&lt;n&gt;]
Junio C Hamano39c7a692010-10-27 06:08:54889</dt>
Junio C Hamano60f8aa82007-03-06 09:58:26890<dd>
891<p>
892 Detect renames.
Junio C Hamano5f2627d2011-05-06 20:23:48893 If <tt>n</tt> is specified, it is a threshold on the similarity
Junio C Hamanoe85e36f2010-08-10 05:30:14894 index (i.e. amount of addition/deletions compared to the
Junio C Hamano68cf15a2010-11-06 01:01:59895 file&#8217;s size). For example, <tt>-M90%</tt> means git should consider a
Junio C Hamanoe85e36f2010-08-10 05:30:14896 delete/add pair to be a rename if more than 90% of the file
Junio C Hamano68cf15a2010-11-06 01:01:59897 hasn&#8217;t changed.
Junio C Hamano60f8aa82007-03-06 09:58:26898</p>
899</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59900<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:14901-C[&lt;n&gt;]
Junio C Hamano60f8aa82007-03-06 09:58:26902</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59903<dt class="hdlist1">
Junio C Hamano0d75e872010-12-17 06:57:26904--find-copies[=&lt;n&gt;]
Junio C Hamano39c7a692010-10-27 06:08:54905</dt>
Junio C Hamano60f8aa82007-03-06 09:58:26906<dd>
907<p>
Junio C Hamano16f98872007-06-12 16:09:14908 Detect copies as well as renames. See also <tt>--find-copies-harder</tt>.
Junio C Hamanoe85e36f2010-08-10 05:30:14909 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:26910</p>
911</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59912<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26913--find-copies-harder
914</dt>
915<dd>
916<p>
Junio C Hamano16f98872007-06-12 16:09:14917 For performance reasons, by default, <tt>-C</tt> option finds copies only
Junio C Hamano60f8aa82007-03-06 09:58:26918 if the original file of the copy was modified in the same
919 changeset. This flag makes the command
920 inspect unmodified files as candidates for the source of
921 copy. This is a very expensive operation for large
Junio C Hamano16f98872007-06-12 16:09:14922 projects, so use it with caution. Giving more than one
923 <tt>-C</tt> option has the same effect.
Junio C Hamano60f8aa82007-03-06 09:58:26924</p>
925</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59926<dt class="hdlist1">
Junio C Hamanob02377c2011-04-28 22:26:02927-D
928</dt>
929<dt class="hdlist1">
930--irreversible-delete
931</dt>
932<dd>
933<p>
934 Omit the preimage for deletes, i.e. print only the header but not
935 the diff between the preimage and <tt>/dev/null</tt>. The resulting patch
936 is not meant to be applied with <tt>patch</tt> nor <tt>git apply</tt>; this is
937 solely for people who want to just concentrate on reviewing the
938 text after the change. In addition, the output obviously lack
939 enough information to apply such a patch in reverse, even manually,
940 hence the name of the option.
941</p>
942<div class="paragraph"><p>When used together with <tt>-B</tt>, omit also the preimage in the deletion part
943of a delete/create pair.</p></div>
944</dd>
945<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26946-l&lt;num&gt;
947</dt>
948<dd>
949<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37950 The <tt>-M</tt> and <tt>-C</tt> options require O(n^2) processing time where n
Junio C Hamano60f8aa82007-03-06 09:58:26951 is the number of potential rename/copy targets. This
952 option prevents rename/copy detection from running if
953 the number of rename/copy targets exceeds the specified
954 number.
955</p>
956</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59957<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26958-O&lt;orderfile&gt;
959</dt>
960<dd>
961<p>
962 Output the patch in the order specified in the
963 &lt;orderfile&gt;, which has one shell glob pattern per line.
964</p>
965</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59966<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:22967-a
968</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59969<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26970--text
971</dt>
972<dd>
973<p>
974 Treat all files as text.
975</p>
976</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59977<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26978--ignore-space-at-eol
979</dt>
980<dd>
981<p>
Junio C Hamano3a702342007-12-12 21:34:02982 Ignore changes in whitespace at EOL.
Junio C Hamano60f8aa82007-03-06 09:58:26983</p>
984</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59985<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:22986-b
987</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59988<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:26989--ignore-space-change
990</dt>
991<dd>
992<p>
Junio C Hamano3a702342007-12-12 21:34:02993 Ignore changes in amount of whitespace. This ignores whitespace
994 at line end, and considers all other sequences of one or
995 more whitespace characters to be equivalent.
Junio C Hamano60f8aa82007-03-06 09:58:26996</p>
997</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59998<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:22999-w
Junio C Hamano60f8aa82007-03-06 09:58:261000</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591001<dt class="hdlist1">
Junio C Hamano60f8aa82007-03-06 09:58:261002--ignore-all-space
1003</dt>
1004<dd>
1005<p>
Junio C Hamano3a702342007-12-12 21:34:021006 Ignore whitespace when comparing lines. This ignores
1007 differences even if one line has whitespace where the other
Junio C Hamano60f8aa82007-03-06 09:58:261008 line has none.
1009</p>
1010</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591011<dt class="hdlist1">
Junio C Hamano1d40ee82009-01-07 10:14:161012--inter-hunk-context=&lt;lines&gt;
1013</dt>
1014<dd>
1015<p>
1016 Show the context between diff hunks, up to the specified number
1017 of lines, thereby fusing hunks that are close to each other.
1018</p>
1019</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591020<dt class="hdlist1">
Junio C Hamano11821ed2011-10-19 18:42:091021-W
1022</dt>
1023<dt class="hdlist1">
1024--function-context
1025</dt>
1026<dd>
1027<p>
1028 Show whole surrounding functions of changes.
1029</p>
1030</dd>
1031<dt class="hdlist1">
Junio C Hamanobb0f4042007-07-04 06:41:401032--ext-diff
1033</dt>
1034<dd>
1035<p>
1036 Allow an external diff helper to be executed. If you set an
Junio C Hamano1b50ce92007-10-03 12:05:531037 external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need
1038 to use this option with <a href="git-log.html">git-log(1)</a> and friends.
Junio C Hamanobb0f4042007-07-04 06:41:401039</p>
1040</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591041<dt class="hdlist1">
Junio C Hamanobb0f4042007-07-04 06:41:401042--no-ext-diff
1043</dt>
1044<dd>
1045<p>
1046 Disallow external diff drivers.
1047</p>
1048</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591049<dt class="hdlist1">
Junio C Hamanoc652aed2011-07-07 01:14:311050--textconv
1051</dt>
1052<dt class="hdlist1">
1053--no-textconv
1054</dt>
1055<dd>
1056<p>
1057 Allow (or disallow) external text conversion filters to be run
1058 when comparing binary files. See <a href="gitattributes.html">gitattributes(5)</a> for
1059 details. Because textconv filters are typically a one-way
1060 conversion, the resulting diff is suitable for human
1061 consumption, but cannot be applied. For this reason, textconv
1062 filters are enabled by default only for <a href="git-diff.html">git-diff(1)</a> and
1063 <a href="git-log.html">git-log(1)</a>, but not for <a href="git-format-patch.html">git-format-patch(1)</a> or
1064 diff plumbing commands.
1065</p>
1066</dd>
1067<dt class="hdlist1">
Junio C Hamano7d449522010-07-01 00:08:511068--ignore-submodules[=&lt;when&gt;]
Junio C Hamanodfccbb02008-05-26 01:16:141069</dt>
1070<dd>
1071<p>
Junio C Hamano7d449522010-07-01 00:08:511072 Ignore changes to submodules in the diff generation. &lt;when&gt; can be
Junio C Hamano619596a2010-08-18 22:15:351073 either "none", "untracked", "dirty" or "all", which is the default
1074 Using "none" will consider the submodule modified when it either contains
1075 untracked or modified files or its HEAD differs from the commit recorded
1076 in the superproject and can be used to override any settings of the
1077 <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:511078 "untracked" is used submodules are not considered dirty when they only
1079 contain untracked content (but they are still scanned for modified
1080 content). Using "dirty" ignores all changes to the work tree of submodules,
1081 only changes to the commits stored in the superproject are shown (this was
1082 the behavior until 1.7.0). Using "all" hides all changes to submodules.
Junio C Hamanodfccbb02008-05-26 01:16:141083</p>
1084</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591085<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331086--src-prefix=&lt;prefix&gt;
1087</dt>
1088<dd>
1089<p>
1090 Show the given source prefix instead of "a/".
1091</p>
1092</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591093<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331094--dst-prefix=&lt;prefix&gt;
1095</dt>
1096<dd>
1097<p>
1098 Show the given destination prefix instead of "b/".
1099</p>
1100</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591101<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331102--no-prefix
1103</dt>
1104<dd>
1105<p>
1106 Do not show any source or destination prefix.
1107</p>
1108</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311109</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:591110<div class="paragraph"><p>For more detailed explanation on these common options, see also
Junio C Hamanoba4b9282008-07-06 05:20:311111<a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591112<div class="dlist"><dl>
1113<dt class="hdlist1">
Junio C Hamanobb0f4042007-07-04 06:41:401114-&lt;n&gt;
1115</dt>
1116<dd>
1117<p>
Junio C Hamano3b4609d2010-09-30 00:04:341118 Prepare patches from the topmost &lt;n&gt; commits.
Junio C Hamanobb0f4042007-07-04 06:41:401119</p>
1120</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591121<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471122-o &lt;dir&gt;
1123</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591124<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471125--output-directory &lt;dir&gt;
Junio C Hamano1a4e8412005-12-27 08:17:231126</dt>
1127<dd>
1128<p>
1129 Use &lt;dir&gt; to store the resulting files, instead of the
Junio C Hamano1bab4b02006-06-06 21:58:331130 current working directory.
Junio C Hamano1a4e8412005-12-27 08:17:231131</p>
1132</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591133<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471134-n
1135</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591136<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471137--numbered
Junio C Hamano1a4e8412005-12-27 08:17:231138</dt>
1139<dd>
1140<p>
Junio C Hamano7d06a8a2008-10-20 05:42:331141 Name output in <em>[PATCH n/m]</em> format, even with a single patch.
Junio C Hamano1a4e8412005-12-27 08:17:231142</p>
1143</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591144<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471145-N
1146</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591147<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471148--no-numbered
Junio C Hamano8c5802d2007-11-15 00:13:361149</dt>
1150<dd>
1151<p>
1152 Name output in <em>[PATCH]</em> format.
1153</p>
1154</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591155<dt class="hdlist1">
Junio C Hamano341071d2006-06-04 07:24:481156--start-number &lt;n&gt;
1157</dt>
1158<dd>
1159<p>
1160 Start numbering the patches at &lt;n&gt; instead of 1.
1161</p>
1162</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591163<dt class="hdlist1">
Junio C Hamano94cad1a2007-06-06 10:48:251164--numbered-files
1165</dt>
1166<dd>
1167<p>
1168 Output file names will be a simple number sequence
1169 without the default first line of the commit appended.
Junio C Hamano94cad1a2007-06-06 10:48:251170</p>
1171</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591172<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471173-k
1174</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591175<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471176--keep-subject
Junio C Hamano1a4e8412005-12-27 08:17:231177</dt>
1178<dd>
1179<p>
1180 Do not strip/add <em>[PATCH]</em> from the first line of the
1181 commit log message.
1182</p>
1183</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591184<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471185-s
1186</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591187<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471188--signoff
Junio C Hamano1a4e8412005-12-27 08:17:231189</dt>
1190<dd>
1191<p>
1192 Add <tt>Signed-off-by:</tt> line to the commit message, using
1193 the committer identity of yourself.
1194</p>
1195</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591196<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231197--stdout
1198</dt>
1199<dd>
1200<p>
Junio C Hamano341071d2006-06-04 07:24:481201 Print all commits to the standard output in mbox format,
1202 instead of creating a file for each one.
Junio C Hamano1a4e8412005-12-27 08:17:231203</p>
1204</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591205<dt class="hdlist1">
Junio C Hamanoc51fede2007-03-12 07:29:201206--attach[=&lt;boundary&gt;]
Junio C Hamano2496ae42006-03-11 08:04:331207</dt>
1208<dd>
1209<p>
Junio C Hamanoc51fede2007-03-12 07:29:201210 Create multipart/mixed attachment, the first part of
1211 which is the commit message and the patch itself in the
Junio C Hamano3b70d3c2009-11-21 17:37:371212 second part, with <tt>Content-Disposition: attachment</tt>.
Junio C Hamanoc51fede2007-03-12 07:29:201213</p>
1214</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591215<dt class="hdlist1">
Junio C Hamano0a235222009-03-06 08:21:091216--no-attach
1217</dt>
1218<dd>
1219<p>
1220 Disable the creation of an attachment, overriding the
1221 configuration setting.
1222</p>
1223</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591224<dt class="hdlist1">
Junio C Hamanoc51fede2007-03-12 07:29:201225--inline[=&lt;boundary&gt;]
1226</dt>
1227<dd>
1228<p>
1229 Create multipart/mixed attachment, the first part of
1230 which is the commit message and the patch itself in the
Junio C Hamano3b70d3c2009-11-21 17:37:371231 second part, with <tt>Content-Disposition: inline</tt>.
Junio C Hamano2496ae42006-03-11 08:04:331232</p>
1233</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591234<dt class="hdlist1">
Junio C Hamanoea6a7642009-03-11 23:56:191235--thread[=&lt;style&gt;]
Junio C Hamanof9ca97d2006-07-25 22:23:091236</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591237<dt class="hdlist1">
Junio C Hamano1bbd0f42009-07-23 06:20:291238--no-thread
1239</dt>
Junio C Hamanof9ca97d2006-07-25 22:23:091240<dd>
1241<p>
Junio C Hamano3b70d3c2009-11-21 17:37:371242 Controls addition of <tt>In-Reply-To</tt> and <tt>References</tt> headers to
Junio C Hamano1bbd0f42009-07-23 06:20:291243 make the second and subsequent mails appear as replies to the
Junio C Hamano3b70d3c2009-11-21 17:37:371244 first. Also controls generation of the <tt>Message-Id</tt> header to
Junio C Hamano1bbd0f42009-07-23 06:20:291245 reference.
Junio C Hamanof9ca97d2006-07-25 22:23:091246</p>
Junio C Hamano68cf15a2010-11-06 01:01:591247<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:591248<em>shallow</em> threading makes every mail a reply to the head of the
Junio C Hamanoea6a7642009-03-11 23:56:191249series, where the head is chosen from the cover letter, the
Junio C Hamanof4581102009-04-25 08:29:591250<tt>--in-reply-to</tt>, and the first patch mail, in this order. <em>deep</em>
Junio C Hamano1bbd0f42009-07-23 06:20:291251threading makes every mail a reply to the previous one.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591252<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:371253is set. If <tt>--thread</tt> is specified without a style, it defaults to the
Junio C Hamano1bbd0f42009-07-23 06:20:291254style specified by <em>format.thread</em> if any, or else <tt>shallow</tt>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591255<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:371256itself. If you want <tt>git format-patch</tt> to take care of threading, you
1257will want to ensure that threading is disabled for <tt>git send-email</tt>.</p></div>
Junio C Hamanof9ca97d2006-07-25 22:23:091258</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591259<dt class="hdlist1">
Junio C Hamanof9ca97d2006-07-25 22:23:091260--in-reply-to=Message-Id
1261</dt>
1262<dd>
1263<p>
Junio C Hamano3b70d3c2009-11-21 17:37:371264 Make the first mail (or all the mails with <tt>--no-thread</tt>) appear as a
Junio C Hamanof9ca97d2006-07-25 22:23:091265 reply to the given Message-Id, which avoids breaking threads to
1266 provide a new patch series.
1267</p>
1268</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591269<dt class="hdlist1">
Junio C Hamano7c73c662007-01-19 00:37:501270--ignore-if-in-upstream
1271</dt>
1272<dd>
1273<p>
1274 Do not include a patch that matches a commit in
1275 &lt;until&gt;..&lt;since&gt;. This will examine all patches reachable
1276 from &lt;since&gt; but not from &lt;until&gt; and compare them with the
1277 patches being generated, and any patch that matches is
1278 ignored.
1279</p>
1280</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591281<dt class="hdlist1">
Junio C Hamano6f1cca82007-04-12 05:02:471282--subject-prefix=&lt;Subject-Prefix&gt;
1283</dt>
1284<dd>
1285<p>
1286 Instead of the standard <em>[PATCH]</em> prefix in the subject
1287 line, instead use <em>[&lt;Subject-Prefix&gt;]</em>. This
1288 allows for useful naming of a patch series, and can be
Junio C Hamano3b70d3c2009-11-21 17:37:371289 combined with the <tt>--numbered</tt> option.
Junio C Hamano6f1cca82007-04-12 05:02:471290</p>
1291</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591292<dt class="hdlist1">
Junio C Hamanoea90ab32010-03-15 20:32:551293--to=&lt;email&gt;
1294</dt>
1295<dd>
1296<p>
1297 Add a <tt>To:</tt> header to the email headers. This is in addition
1298 to any configured headers, and may be used multiple times.
Junio C Hamano7bd050f2011-09-22 06:32:221299 The negated form <tt>--no-to</tt> discards all <tt>To:</tt> headers added so
1300 far (from config or command line).
Junio C Hamanoea90ab32010-03-15 20:32:551301</p>
1302</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591303<dt class="hdlist1">
Junio C Hamano24bc09a2008-02-28 00:27:441304--cc=&lt;email&gt;
1305</dt>
1306<dd>
1307<p>
Junio C Hamano3b70d3c2009-11-21 17:37:371308 Add a <tt>Cc:</tt> header to the email headers. This is in addition
Junio C Hamano24bc09a2008-02-28 00:27:441309 to any configured headers, and may be used multiple times.
Junio C Hamano7bd050f2011-09-22 06:32:221310 The negated form <tt>--no-cc</tt> discards all <tt>Cc:</tt> headers added so
1311 far (from config or command line).
Junio C Hamano24bc09a2008-02-28 00:27:441312</p>
1313</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591314<dt class="hdlist1">
Junio C Hamano9572e922009-04-02 06:52:031315--add-header=&lt;header&gt;
1316</dt>
1317<dd>
1318<p>
1319 Add an arbitrary header to the email headers. This is in addition
1320 to any configured headers, and may be used multiple times.
Junio C Hamano7bd050f2011-09-22 06:32:221321 For example, <tt>--add-header="Organization: git-foo"</tt>.
1322 The negated form <tt>--no-add-header</tt> discards <strong>all</strong> (<tt>To:</tt>,
1323 <tt>Cc:</tt>, and custom) headers added so far from config or command
1324 line.
Junio C Hamano9572e922009-04-02 06:52:031325</p>
1326</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591327<dt class="hdlist1">
Junio C Hamano24bc09a2008-02-28 00:27:441328--cover-letter
1329</dt>
1330<dd>
1331<p>
Junio C Hamano92a4abd2008-08-15 05:34:441332 In addition to the patches, generate a cover letter file
1333 containing the shortlog and the overall diffstat. You can
1334 fill in a description in the file before sending it out.
Junio C Hamano24bc09a2008-02-28 00:27:441335</p>
1336</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591337<dt class="hdlist1">
Junio C Hamano89a57342010-06-22 23:22:551338--[no]-signature=&lt;signature&gt;
1339</dt>
1340<dd>
1341<p>
1342 Add a signature to each message produced. Per RFC 3676 the signature
Junio C Hamano68cf15a2010-11-06 01:01:591343 is separated from the body by a line with '-- ' on it. If the
Junio C Hamano89a57342010-06-22 23:22:551344 signature option is omitted the signature defaults to the git version
1345 number.
1346</p>
1347</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591348<dt class="hdlist1">
Junio C Hamano4f9a6052007-01-17 20:25:161349--suffix=.&lt;sfx&gt;
1350</dt>
1351<dd>
1352<p>
Junio C Hamano7c73c662007-01-19 00:37:501353 Instead of using <tt>.patch</tt> as the suffix for generated
Junio C Hamanoa6387422007-08-25 03:54:271354 filenames, use specified suffix. A common alternative is
Junio C Hamanof4581102009-04-25 08:29:591355 <tt>--suffix=.txt</tt>. Leaving this empty will remove the <tt>.patch</tt>
1356 suffix.
Junio C Hamano4f9a6052007-01-17 20:25:161357</p>
Junio C Hamano68cf15a2010-11-06 01:01:591358<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:591359you 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:161360</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591361<dt class="hdlist1">
Junio C Hamano209ebe82011-04-27 21:09:591362--quiet
1363</dt>
1364<dd>
1365<p>
1366 Do not print the names of the generated files to standard output.
1367</p>
1368</dd>
1369<dt class="hdlist1">
Junio C Hamano869bb802008-05-12 00:29:471370--no-binary
1371</dt>
1372<dd>
1373<p>
Junio C Hamanof4581102009-04-25 08:29:591374 Do not output contents of changes in binary files, instead
1375 display a notice that those files changed. Patches generated
1376 using this option cannot be applied properly, but they are
1377 still useful for code review.
Junio C Hamano869bb802008-05-12 00:29:471378</p>
1379</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591380<dt class="hdlist1">
Junio C Hamano9572e922009-04-02 06:52:031381--root
1382</dt>
1383<dd>
1384<p>
1385 Treat the revision argument as a &lt;revision range&gt;, even if it
1386 is just a single commit (that would normally be treated as a
1387 &lt;since&gt;). Note that root commits included in the specified
1388 range are always formatted as creation patches, independently
1389 of this flag.
1390</p>
1391</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311392</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:231393</div>
Junio C Hamanoba4b9282008-07-06 05:20:311394<h2 id="_configuration">CONFIGURATION</h2>
Junio C Hamano2496ae42006-03-11 08:04:331395<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591396<div class="paragraph"><p>You can specify extra mail header lines to be added to each message,
Junio C Hamanof4581102009-04-25 08:29:591397defaults for the subject prefix and file suffix, number patches when
Junio C Hamanoea90ab32010-03-15 20:32:551398outputting more than one patch, add "To" or "Cc:" headers, configure
1399attachments, and sign off patches with configuration variables.</p></div>
Junio C Hamano7c73c662007-01-19 00:37:501400<div class="listingblock">
Junio C Hamano2496ae42006-03-11 08:04:331401<div class="content">
Junio C Hamano7c73c662007-01-19 00:37:501402<pre><tt>[format]
1403 headers = "Organization: git-foo\n"
Junio C Hamano1d90cb02007-07-03 07:05:311404 subjectprefix = CHANGE
Junio C Hamano8c5802d2007-11-15 00:13:361405 suffix = .txt
Junio C Hamano2fbcd212008-05-14 22:26:071406 numbered = auto
Junio C Hamanoea90ab32010-03-15 20:32:551407 to = &lt;email&gt;
Junio C Hamano0a235222009-03-06 08:21:091408 cc = &lt;email&gt;
Junio C Hamano5f9a6f02009-04-06 08:26:561409 attach [ = mime-boundary-string ]
1410 signoff = true</tt></pre>
Junio C Hamano4f9a6052007-01-17 20:25:161411</div></div>
Junio C Hamano2496ae42006-03-11 08:04:331412</div>
Junio C Hamanob77f8192011-05-05 01:30:381413<h2 id="_discussion">DISCUSSION</h2>
1414<div class="sectionbody">
1415<div class="paragraph"><p>The patch produced by <em>git format-patch</em> is in UNIX mailbox format,
1416with a fixed "magic" time stamp to indicate that the file is output
1417from format-patch rather than a real mailbox, like so:</p></div>
1418<div class="listingblock">
1419<div class="content">
1420<pre><tt>From 8f72bad1baf19a53459661343e21d6491c3908d3 Mon Sep 17 00:00:00 2001
1421From: Tony Luck &lt;tony.luck@intel.com&gt;
1422Date: Tue, 13 Jul 2010 11:42:54 -0700
1423Subject: [PATCH] =?UTF-8?q?[IA64]=20Put=20ia64=20config=20files=20on=20the=20?=
1424 =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig=20diet?=
1425MIME-Version: 1.0
1426Content-Type: text/plain; charset=UTF-8
1427Content-Transfer-Encoding: 8bit
1428
1429arch/arm config files were slimmed down using a python script
1430(See commit c2330e286f68f1c408b4aa6515ba49d57f05beae comment)
1431
1432Do the same for ia64 so we can have sleek &amp; trim looking
1433...</tt></pre>
1434</div></div>
1435<div class="paragraph"><p>Typically it will be placed in a MUA&#8217;s drafts folder, edited to add
1436timely commentary that should not go in the changelog after the three
1437dashes, and then sent as a message whose body, in our example, starts
1438with "arch/arm config files were&#8230;". On the receiving end, readers
1439can save interesting patches in a UNIX mailbox and apply them with
1440<a href="git-am.html">git-am(1)</a>.</p></div>
1441<div class="paragraph"><p>When a patch is part of an ongoing discussion, the patch generated by
1442<em>git format-patch</em> can be tweaked to take advantage of the <em>git am
1443--scissors</em> feature. After your response to the discussion comes a
1444line that consists solely of "<tt>-- &gt;8 --</tt>" (scissors and perforation),
1445followed by the patch with unnecessary header fields removed:</p></div>
1446<div class="listingblock">
1447<div class="content">
1448<pre><tt>...
1449&gt; So we should do such-and-such.
1450
1451Makes sense to me. How about this patch?
1452
1453-- &gt;8 --
1454Subject: [IA64] Put ia64 config files on the Uwe Kleine-König diet
1455
1456arch/arm config files were slimmed down using a python script
1457...</tt></pre>
1458</div></div>
1459<div class="paragraph"><p>When sending a patch this way, most often you are sending your own
1460patch, so in addition to the "<tt>From $SHA1 $magic_timestamp</tt>" marker you
1461should omit <tt>From:</tt> and <tt>Date:</tt> lines from the patch file. The patch
1462title is likely to be different from the subject of the discussion the
1463patch is in response to, so it is likely that you would want to keep
1464the Subject: line, like the example above.</p></div>
1465<h3 id="_checking_for_patch_corruption">Checking for patch corruption</h3><div style="clear:left"></div>
1466<div class="paragraph"><p>Many mailers if not set up properly will corrupt whitespace. Here are
1467two common types of corruption:</p></div>
1468<div class="ulist"><ul>
1469<li>
1470<p>
1471Empty context lines that do not have <em>any</em> whitespace.
1472</p>
1473</li>
1474<li>
1475<p>
1476Non-empty context lines that have one extra whitespace at the
1477 beginning.
1478</p>
1479</li>
1480</ul></div>
1481<div class="paragraph"><p>One way to test if your MUA is set up correctly is:</p></div>
1482<div class="ulist"><ul>
1483<li>
1484<p>
1485Send the patch to yourself, exactly the way you would, except
1486 with To: and Cc: lines that do not contain the list and
1487 maintainer address.
1488</p>
1489</li>
1490<li>
1491<p>
1492Save that patch to a file in UNIX mailbox format. Call it a.patch,
1493 say.
1494</p>
1495</li>
1496<li>
1497<p>
1498Apply it:
1499</p>
1500<div class="literalblock">
1501<div class="content">
1502<pre><tt>$ git fetch &lt;project&gt; master:test-apply
1503$ git checkout test-apply
1504$ git reset --hard
1505$ git am a.patch</tt></pre>
1506</div></div>
1507</li>
1508</ul></div>
1509<div class="paragraph"><p>If it does not apply correctly, there can be various reasons.</p></div>
1510<div class="ulist"><ul>
1511<li>
1512<p>
1513The patch itself does not apply cleanly. That is <em>bad</em> but
1514 does not have much to do with your MUA. You might want to rebase
1515 the patch with <a href="git-rebase.html">git-rebase(1)</a> before regenerating it in
1516 this case.
1517</p>
1518</li>
1519<li>
1520<p>
1521The MUA corrupted your patch; "am" would complain that
1522 the patch does not apply. Look in the .git/rebase-apply/ subdirectory and
1523 see what <em>patch</em> file contains and check for the common
1524 corruption patterns mentioned above.
1525</p>
1526</li>
1527<li>
1528<p>
1529While at it, check the <em>info</em> and <em>final-commit</em> files as well.
1530 If what is in <em>final-commit</em> is not exactly what you would want to
1531 see in the commit log message, it is very likely that the
1532 receiver would end up hand editing the log message when applying
1533 your patch. Things like "Hi, this is my first patch.\n" in the
1534 patch e-mail should come after the three-dash line that signals
1535 the end of the commit message.
1536</p>
1537</li>
1538</ul></div>
1539</div>
1540<h2 id="_mua_specific_hints">MUA-SPECIFIC HINTS</h2>
1541<div class="sectionbody">
1542<div class="paragraph"><p>Here are some hints on how to successfully submit patches inline using
1543various mailers.</p></div>
1544<h3 id="_gmail">GMail</h3><div style="clear:left"></div>
1545<div class="paragraph"><p>GMail does not have any way to turn off line wrapping in the web
1546interface, so it will mangle any emails that you send. You can however
1547use "git send-email" and send your patches through the GMail SMTP server, or
1548use any IMAP email client to connect to the google IMAP server and forward
1549the emails through that.</p></div>
1550<div class="paragraph"><p>For hints on using <em>git send-email</em> to send your patches through the
1551GMail SMTP server, see the EXAMPLE section of <a href="git-send-email.html">git-send-email(1)</a>.</p></div>
1552<div class="paragraph"><p>For hints on submission using the IMAP interface, see the EXAMPLE
1553section of <a href="git-imap-send.html">git-imap-send(1)</a>.</p></div>
1554<h3 id="_thunderbird">Thunderbird</h3><div style="clear:left"></div>
1555<div class="paragraph"><p>By default, Thunderbird will both wrap emails as well as flag
1556them as being <em>format=flowed</em>, both of which will make the
1557resulting email unusable by git.</p></div>
1558<div class="paragraph"><p>There are three different approaches: use an add-on to turn off line wraps,
1559configure Thunderbird to not mangle patches, or use
1560an external editor to keep Thunderbird from mangling the patches.</p></div>
1561<h4 id="_approach_1_add_on">Approach #1 (add-on)</h4>
1562<div class="paragraph"><p>Install the Toggle Word Wrap add-on that is available from
1563<a href="https://addons.mozilla.org/thunderbird/addon/toggle-word-wrap/">https://addons.mozilla.org/thunderbird/addon/toggle-word-wrap/</a>
1564It adds a menu entry "Enable Word Wrap" in the composer&#8217;s "Options" menu
1565that you can tick off. Now you can compose the message as you otherwise do
1566(cut + paste, <em>git format-patch</em> | <em>git imap-send</em>, etc), but you have to
1567insert line breaks manually in any text that you type.</p></div>
1568<h4 id="_approach_2_configuration">Approach #2 (configuration)</h4>
1569<div class="paragraph"><p>Three steps:</p></div>
1570<div class="olist arabic"><ol class="arabic">
1571<li>
1572<p>
1573Configure your mail server composition as plain text:
1574 Edit&#8230;Account Settings&#8230;Composition &amp; Addressing,
1575 uncheck "Compose Messages in HTML".
1576</p>
1577</li>
1578<li>
1579<p>
1580Configure your general composition window to not wrap.
1581</p>
1582<div class="paragraph"><p>In Thunderbird 2:
1583Edit..Preferences..Composition, wrap plain text messages at 0</p></div>
1584<div class="paragraph"><p>In Thunderbird 3:
1585Edit..Preferences..Advanced..Config Editor. Search for
1586"mail.wrap_long_lines".
1587Toggle it to make sure it is set to <tt>false</tt>.</p></div>
1588</li>
1589<li>
1590<p>
1591Disable the use of format=flowed:
1592Edit..Preferences..Advanced..Config Editor. Search for
1593"mailnews.send_plaintext_flowed".
1594Toggle it to make sure it is set to <tt>false</tt>.
1595</p>
1596</li>
1597</ol></div>
1598<div class="paragraph"><p>After that is done, you should be able to compose email as you
1599otherwise would (cut + paste, <em>git format-patch</em> | <em>git imap-send</em>, etc),
1600and the patches will not be mangled.</p></div>
1601<h4 id="_approach_3_external_editor">Approach #3 (external editor)</h4>
1602<div class="paragraph"><p>The following Thunderbird extensions are needed:
1603AboutConfig from <a href="http://aboutconfig.mozdev.org/">http://aboutconfig.mozdev.org/</a> and
1604External 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>
1605<div class="olist arabic"><ol class="arabic">
1606<li>
1607<p>
1608Prepare the patch as a text file using your method of choice.
1609</p>
1610</li>
1611<li>
1612<p>
1613Before opening a compose window, use Edit&#8594;Account Settings to
1614 uncheck the "Compose messages in HTML format" setting in the
1615 "Composition &amp; Addressing" panel of the account to be used to
1616 send the patch.
1617</p>
1618</li>
1619<li>
1620<p>
1621In the main Thunderbird window, <em>before</em> you open the compose
1622 window for the patch, use Tools&#8594;about:config to set the
1623 following to the indicated values:
1624</p>
1625<div class="listingblock">
1626<div class="content">
1627<pre><tt> mailnews.send_plaintext_flowed =&gt; false
1628 mailnews.wraplength =&gt; 0</tt></pre>
1629</div></div>
1630</li>
1631<li>
1632<p>
1633Open a compose window and click the external editor icon.
1634</p>
1635</li>
1636<li>
1637<p>
1638In the external editor window, read in the patch file and exit
1639 the editor normally.
1640</p>
1641</li>
1642</ol></div>
1643<div class="paragraph"><p>Side note: it may be possible to do step 2 with
1644about:config and the following settings but no one&#8217;s tried yet.</p></div>
1645<div class="listingblock">
1646<div class="content">
1647<pre><tt> mail.html_compose =&gt; false
1648 mail.identity.default.compose_html =&gt; false
1649 mail.identity.id?.compose_html =&gt; false</tt></pre>
1650</div></div>
1651<div class="paragraph"><p>There is a script in contrib/thunderbird-patch-inline which can help
1652you include patches with Thunderbird in an easy way. To use it, do the
1653steps above and then use the script as the external editor.</p></div>
1654<h3 id="_kmail">KMail</h3><div style="clear:left"></div>
1655<div class="paragraph"><p>This should help you to submit patches inline using KMail.</p></div>
1656<div class="olist arabic"><ol class="arabic">
1657<li>
1658<p>
1659Prepare the patch as a text file.
1660</p>
1661</li>
1662<li>
1663<p>
1664Click on New Mail.
1665</p>
1666</li>
1667<li>
1668<p>
1669Go under "Options" in the Composer window and be sure that
1670 "Word wrap" is not set.
1671</p>
1672</li>
1673<li>
1674<p>
1675Use Message &#8594; Insert file&#8230; and insert the patch.
1676</p>
1677</li>
1678<li>
1679<p>
1680Back in the compose window: add whatever other text you wish to the
1681 message, complete the addressing and subject fields, and press send.
1682</p>
1683</li>
1684</ol></div>
1685</div>
Junio C Hamanoba4b9282008-07-06 05:20:311686<h2 id="_examples">EXAMPLES</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231687<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591688<div class="ulist"><ul>
Junio C Hamano6d76d612008-05-09 05:46:081689<li>
Junio C Hamano1a4e8412005-12-27 08:17:231690<p>
Junio C Hamano6d76d612008-05-09 05:46:081691Extract commits between revisions R1 and R2, and apply them on top of
Junio C Hamano1aa40d22010-01-21 17:46:431692the current branch using <em>git am</em> to cherry-pick them:
Junio C Hamano1a4e8412005-12-27 08:17:231693</p>
Junio C Hamano6d76d612008-05-09 05:46:081694<div class="listingblock">
1695<div class="content">
Junio C Hamanoba4b9282008-07-06 05:20:311696<pre><tt>$ git format-patch -k --stdout R1..R2 | git am -3 -k</tt></pre>
Junio C Hamano6d76d612008-05-09 05:46:081697</div></div>
1698</li>
1699<li>
Junio C Hamano1a4e8412005-12-27 08:17:231700<p>
Junio C Hamano6d76d612008-05-09 05:46:081701Extract all commits which are in the current branch but not in the
1702origin branch:
Junio C Hamano1a4e8412005-12-27 08:17:231703</p>
Junio C Hamano6d76d612008-05-09 05:46:081704<div class="listingblock">
1705<div class="content">
1706<pre><tt>$ git format-patch origin</tt></pre>
1707</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591708<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:081709</li>
1710<li>
Junio C Hamano7d9e9bd2007-08-29 07:31:471711<p>
Junio C Hamano6d76d612008-05-09 05:46:081712Extract all commits that lead to <em>origin</em> since the inception of the
1713project:
Junio C Hamano7d9e9bd2007-08-29 07:31:471714</p>
Junio C Hamano6d76d612008-05-09 05:46:081715<div class="listingblock">
1716<div class="content">
Junio C Hamanoba4b9282008-07-06 05:20:311717<pre><tt>$ git format-patch --root origin</tt></pre>
Junio C Hamano6d76d612008-05-09 05:46:081718</div></div>
1719</li>
1720<li>
Junio C Hamano1a4e8412005-12-27 08:17:231721<p>
Junio C Hamano6d76d612008-05-09 05:46:081722The same as the previous one:
Junio C Hamano1a4e8412005-12-27 08:17:231723</p>
Junio C Hamano6d76d612008-05-09 05:46:081724<div class="listingblock">
1725<div class="content">
1726<pre><tt>$ git format-patch -M -B origin</tt></pre>
1727</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591728<div class="paragraph"><p>Additionally, it detects and handles renames and complete rewrites
Junio C Hamano6d76d612008-05-09 05:46:081729intelligently to produce a renaming patch. A renaming patch reduces
Junio C Hamanof4581102009-04-25 08:29:591730the amount of text output, and generally makes it easier to review.
Junio C Hamano68cf15a2010-11-06 01:01:591731Note that non-git "patch" programs won&#8217;t understand renaming patches, so
Junio C Hamanoba4b9282008-07-06 05:20:311732use it only when you know the recipient uses git to apply your patch.</p></div>
Junio C Hamano6d76d612008-05-09 05:46:081733</li>
1734<li>
Junio C Hamano7c73c662007-01-19 00:37:501735<p>
Junio C Hamano6d76d612008-05-09 05:46:081736Extract three topmost commits from the current branch and format them
1737as e-mailable patches:
Junio C Hamano7c73c662007-01-19 00:37:501738</p>
Junio C Hamano6d76d612008-05-09 05:46:081739<div class="listingblock">
1740<div class="content">
1741<pre><tt>$ git format-patch -3</tt></pre>
1742</div></div>
1743</li>
Junio C Hamanoba4b9282008-07-06 05:20:311744</ul></div>
Junio C Hamano1a4e8412005-12-27 08:17:231745</div>
Junio C Hamanoba4b9282008-07-06 05:20:311746<h2 id="_see_also">SEE ALSO</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231747<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591748<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:231749</div>
Junio C Hamanoba4b9282008-07-06 05:20:311750<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231751<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591752<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231753</div>
Junio C Hamano7bd050f2011-09-22 06:32:221754</div>
1755<div id="footnotes"><hr /></div>
Junio C Hamano1a4e8412005-12-27 08:17:231756<div id="footer">
1757<div id="footer-text">
Junio C Hamano7bd050f2011-09-22 06:32:221758Last updated 2011-09-21 23:01:14 PDT
Junio C Hamano1a4e8412005-12-27 08:17:231759</div>
1760</div>
1761</body>
1762</html>