OSDN Git Service

Add Git official document to help
[tortoisegit/TortoiseGitJp.git] / doc / source / en / TortoiseGit / git_doc / git-format-patch.html.xml
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">\r
3 \r
4 <article lang="en" id="git-format-patch(1)">\r
5 <articleinfo>\r
6     <title>git-format-patch(1)</title>\r
7         <indexterm>\r
8                 <primary>git-format-patch(1)</primary>\r
9         </indexterm>\r
10 </articleinfo>\r
11 <simplesect id="_name">\r
12 <title>NAME</title>\r
13 <simpara>git-format-patch - Prepare patches for e-mail submission</simpara>\r
14 </simplesect>\r
15 <simplesect id="_synopsis">\r
16 <title>SYNOPSIS</title>\r
17 <blockquote>\r
18 <literallayout><emphasis>git format-patch</emphasis> [-k] [-o &lt;dir&gt; | --stdout] [--thread]\r
19                    [--attach[=&lt;boundary&gt;] | --inline[=&lt;boundary&gt;]]\r
20                    [-s | --signoff] [&lt;common diff options&gt;]\r
21                    [-n | --numbered | -N | --no-numbered]\r
22                    [--start-number &lt;n&gt;] [--numbered-files]\r
23                    [--in-reply-to=Message-Id] [--suffix=.&lt;sfx&gt;]\r
24                    [--ignore-if-in-upstream]\r
25                    [--subject-prefix=Subject-Prefix]\r
26                    [--cc=&lt;email&gt;]\r
27                    [--cover-letter]\r
28                    [ &lt;since&gt; | &lt;revision range&gt; ]</literallayout>\r
29 </blockquote>\r
30 </simplesect>\r
31 <simplesect id="_description">\r
32 <title>DESCRIPTION</title>\r
33 <simpara>Prepare each commit with its patch in\r
34 one file per commit, formatted to resemble UNIX mailbox format.\r
35 The output of this command is convenient for e-mail submission or\r
36 for use with <emphasis>git-am</emphasis>.</simpara>\r
37 <simpara>There are two ways to specify which commits to operate on.</simpara>\r
38 <orderedlist numeration="arabic">\r
39 <listitem>\r
40 <simpara>\r
41 A single commit, &lt;since&gt;, specifies that the commits leading\r
42    to the tip of the current branch that are not in the history\r
43    that leads to the &lt;since&gt; to be output.\r
44 </simpara>\r
45 </listitem>\r
46 <listitem>\r
47 <simpara>\r
48 Generic &lt;revision range&gt; expression (see "SPECIFYING\r
49    REVISIONS" section in <xref linkend="git-rev-parse(1)"/>) means the\r
50    commits in the specified range.\r
51 </simpara>\r
52 </listitem>\r
53 </orderedlist>\r
54 <simpara>A single commit, when interpreted as a &lt;revision range&gt;\r
55 expression, means "everything that leads to that commit", but\r
56 if you write <emphasis>git format-patch &lt;commit&gt;</emphasis>, the previous rule\r
57 applies to that command line and you do not get "everything\r
58 since the beginning of the time".  If you want to format\r
59 everything since project inception to one commit, say "git\r
60 format-patch --root &lt;commit&gt;" to make it clear that it is the\r
61 latter case.  If you want to format a single commit, you can do\r
62 this with "git format-patch -1 &lt;commit&gt;".</simpara>\r
63 <simpara>By default, each output file is numbered sequentially from 1, and uses the\r
64 first line of the commit message (massaged for pathname safety) as\r
65 the filename. With the --numbered-files option, the output file names\r
66 will only be numbers, without the first line of the commit appended.\r
67 The names of the output files are printed to standard\r
68 output, unless the --stdout option is specified.</simpara>\r
69 <simpara>If -o is specified, output files are created in &lt;dir&gt;.  Otherwise\r
70 they are created in the current working directory.</simpara>\r
71 <simpara>By default, the subject of a single patch is "[PATCH] First Line" and\r
72 the subject when multiple patches are output is "[PATCH n/m] First\r
73 Line". To force 1/1 to be added for a single patch, use -n.  To omit\r
74 patch numbers from the subject, use -N</simpara>\r
75 <simpara>If given --thread, <emphasis>git-format-patch</emphasis> will generate In-Reply-To and\r
76 References headers to make the second and subsequent patch mails appear\r
77 as replies to the first mail; this also generates a Message-Id header to\r
78 reference.</simpara>\r
79 </simplesect>\r
80 <simplesect id="_options">\r
81 <title>OPTIONS</title>\r
82 <variablelist>\r
83 <varlistentry>\r
84 <term>\r
85 -p\r
86 </term>\r
87 <listitem>\r
88 <simpara>\r
89         Generate patches without diffstat.\r
90 </simpara>\r
91 </listitem>\r
92 </varlistentry>\r
93 <varlistentry>\r
94 <term>\r
95 -U&lt;n&gt;\r
96 </term>\r
97 <term>\r
98 --unified=&lt;n&gt;\r
99 </term>\r
100 <listitem>\r
101 <simpara>\r
102         Generate diffs with &lt;n&gt; lines of context instead of\r
103         the usual three. Implies "-p".\r
104 </simpara>\r
105 </listitem>\r
106 </varlistentry>\r
107 <varlistentry>\r
108 <term>\r
109 --raw\r
110 </term>\r
111 <listitem>\r
112 <simpara>\r
113         Generate the raw format.\r
114         \r
115 </simpara>\r
116 </listitem>\r
117 </varlistentry>\r
118 <varlistentry>\r
119 <term>\r
120 --patch-with-raw\r
121 </term>\r
122 <listitem>\r
123 <simpara>\r
124         Synonym for "-p --raw".\r
125 </simpara>\r
126 </listitem>\r
127 </varlistentry>\r
128 <varlistentry>\r
129 <term>\r
130 --patience\r
131 </term>\r
132 <listitem>\r
133 <simpara>\r
134         Generate a diff using the "patience diff" algorithm.\r
135 </simpara>\r
136 </listitem>\r
137 </varlistentry>\r
138 <varlistentry>\r
139 <term>\r
140 --stat[=width[,name-width]]\r
141 </term>\r
142 <listitem>\r
143 <simpara>\r
144         Generate a diffstat.  You can override the default\r
145         output width for 80-column terminal by "--stat=width".\r
146         The width of the filename part can be controlled by\r
147         giving another width to it separated by a comma.\r
148 </simpara>\r
149 </listitem>\r
150 </varlistentry>\r
151 <varlistentry>\r
152 <term>\r
153 --numstat\r
154 </term>\r
155 <listitem>\r
156 <simpara>\r
157         Similar to --stat, but shows number of added and\r
158         deleted lines in decimal notation and pathname without\r
159         abbreviation, to make it more machine friendly.  For\r
160         binary files, outputs two <literal>-</literal> instead of saying\r
161         <literal>0 0</literal>.\r
162 </simpara>\r
163 </listitem>\r
164 </varlistentry>\r
165 <varlistentry>\r
166 <term>\r
167 --shortstat\r
168 </term>\r
169 <listitem>\r
170 <simpara>\r
171         Output only the last line of the --stat format containing total\r
172         number of modified files, as well as number of added and deleted\r
173         lines.\r
174 </simpara>\r
175 </listitem>\r
176 </varlistentry>\r
177 <varlistentry>\r
178 <term>\r
179 --dirstat[=limit]\r
180 </term>\r
181 <listitem>\r
182 <simpara>\r
183         Output the distribution of relative amount of changes (number of lines added or\r
184         removed) for each sub-directory. Directories with changes below\r
185         a cut-off percent (3% by default) are not shown. The cut-off percent\r
186         can be set with "--dirstat=limit". Changes in a child directory is not\r
187         counted for the parent directory, unless "--cumulative" is used.\r
188 </simpara>\r
189 </listitem>\r
190 </varlistentry>\r
191 <varlistentry>\r
192 <term>\r
193 --dirstat-by-file[=limit]\r
194 </term>\r
195 <listitem>\r
196 <simpara>\r
197         Same as --dirstat, but counts changed files instead of lines.\r
198 </simpara>\r
199 </listitem>\r
200 </varlistentry>\r
201 <varlistentry>\r
202 <term>\r
203 --summary\r
204 </term>\r
205 <listitem>\r
206 <simpara>\r
207         Output a condensed summary of extended header information\r
208         such as creations, renames and mode changes.\r
209 </simpara>\r
210 </listitem>\r
211 </varlistentry>\r
212 <varlistentry>\r
213 <term>\r
214 --patch-with-stat\r
215 </term>\r
216 <listitem>\r
217 <simpara>\r
218         Synonym for "-p --stat".\r
219          This is the default.\r
220 </simpara>\r
221 </listitem>\r
222 </varlistentry>\r
223 <varlistentry>\r
224 <term>\r
225 -z\r
226 </term>\r
227 <listitem>\r
228 <simpara>\r
229         NUL-line termination on output.  This affects the --raw\r
230         output field terminator.  Also output from commands such\r
231         as "git-log" will be delimited with NUL between commits.\r
232 </simpara>\r
233 </listitem>\r
234 </varlistentry>\r
235 <varlistentry>\r
236 <term>\r
237 --name-only\r
238 </term>\r
239 <listitem>\r
240 <simpara>\r
241         Show only names of changed files.\r
242 </simpara>\r
243 </listitem>\r
244 </varlistentry>\r
245 <varlistentry>\r
246 <term>\r
247 --name-status\r
248 </term>\r
249 <listitem>\r
250 <simpara>\r
251         Show only names and status of changed files. See the description\r
252         of the <literal>--diff-filter</literal> option on what the status letters mean.\r
253 </simpara>\r
254 </listitem>\r
255 </varlistentry>\r
256 <varlistentry>\r
257 <term>\r
258 --color\r
259 </term>\r
260 <listitem>\r
261 <simpara>\r
262         Show colored diff.\r
263 </simpara>\r
264 </listitem>\r
265 </varlistentry>\r
266 <varlistentry>\r
267 <term>\r
268 --no-color\r
269 </term>\r
270 <listitem>\r
271 <simpara>\r
272         Turn off colored diff, even when the configuration file\r
273         gives the default to color output.\r
274 </simpara>\r
275 </listitem>\r
276 </varlistentry>\r
277 <varlistentry>\r
278 <term>\r
279 --color-words[=&lt;regex&gt;]\r
280 </term>\r
281 <listitem>\r
282 <simpara>\r
283         Show colored word diff, i.e., color words which have changed.\r
284         By default, words are separated by whitespace.\r
285 </simpara>\r
286 <simpara>When a &lt;regex&gt; is specified, every non-overlapping match of the\r
287 &lt;regex&gt; is considered a word.  Anything between these matches is\r
288 considered whitespace and ignored(!) for the purposes of finding\r
289 differences.  You may want to append <literal>|[^[:space:]]</literal> to your regular\r
290 expression to make sure that it matches all non-whitespace characters.\r
291 A match that contains a newline is silently truncated(!) at the\r
292 newline.</simpara>\r
293 <simpara>The regex can also be set via a diff driver or configuration option, see\r
294 <xref linkend="gitattributes(1)"/> or <xref linkend="git-config(1)"/>.  Giving it explicitly\r
295 overrides any diff driver or configuration setting.  Diff drivers\r
296 override configuration settings.</simpara>\r
297 </listitem>\r
298 </varlistentry>\r
299 <varlistentry>\r
300 <term>\r
301 --no-renames\r
302 </term>\r
303 <listitem>\r
304 <simpara>\r
305         Turn off rename detection, even when the configuration\r
306         file gives the default to do so.\r
307 </simpara>\r
308 </listitem>\r
309 </varlistentry>\r
310 <varlistentry>\r
311 <term>\r
312 --check\r
313 </term>\r
314 <listitem>\r
315 <simpara>\r
316         Warn if changes introduce trailing whitespace\r
317         or an indent that uses a space before a tab. Exits with\r
318         non-zero status if problems are found. Not compatible with\r
319         --exit-code.\r
320 </simpara>\r
321 </listitem>\r
322 </varlistentry>\r
323 <varlistentry>\r
324 <term>\r
325 --full-index\r
326 </term>\r
327 <listitem>\r
328 <simpara>\r
329         Instead of the first handful of characters, show the full\r
330         pre- and post-image blob object names on the "index"\r
331         line when generating patch format output.\r
332 </simpara>\r
333 </listitem>\r
334 </varlistentry>\r
335 <varlistentry>\r
336 <term>\r
337 --binary\r
338 </term>\r
339 <listitem>\r
340 <simpara>\r
341         In addition to --full-index, output "binary diff" that\r
342         can be applied with "git apply".\r
343 </simpara>\r
344 </listitem>\r
345 </varlistentry>\r
346 <varlistentry>\r
347 <term>\r
348 --abbrev[=&lt;n&gt;]\r
349 </term>\r
350 <listitem>\r
351 <simpara>\r
352         Instead of showing the full 40-byte hexadecimal object\r
353         name in diff-raw format output and diff-tree header\r
354         lines, show only a partial prefix.  This is\r
355         independent of --full-index option above, which controls\r
356         the diff-patch output format.  Non default number of\r
357         digits can be specified with --abbrev=&lt;n&gt;.\r
358 </simpara>\r
359 </listitem>\r
360 </varlistentry>\r
361 <varlistentry>\r
362 <term>\r
363 -B\r
364 </term>\r
365 <listitem>\r
366 <simpara>\r
367         Break complete rewrite changes into pairs of delete and create.\r
368 </simpara>\r
369 </listitem>\r
370 </varlistentry>\r
371 <varlistentry>\r
372 <term>\r
373 -M\r
374 </term>\r
375 <listitem>\r
376 <simpara>\r
377         Detect renames.\r
378 </simpara>\r
379 </listitem>\r
380 </varlistentry>\r
381 <varlistentry>\r
382 <term>\r
383 -C\r
384 </term>\r
385 <listitem>\r
386 <simpara>\r
387         Detect copies as well as renames.  See also <literal>--find-copies-harder</literal>.\r
388 </simpara>\r
389 </listitem>\r
390 </varlistentry>\r
391 <varlistentry>\r
392 <term>\r
393 --diff-filter=[ACDMRTUXB*]\r
394 </term>\r
395 <listitem>\r
396 <simpara>\r
397         Select only files that are Added (<literal>A</literal>), Copied (<literal>C</literal>),\r
398         Deleted (<literal>D</literal>), Modified (<literal>M</literal>), Renamed (<literal>R</literal>), have their\r
399         type (i.e. regular file, symlink, submodule, &#8230;) changed (<literal>T</literal>),\r
400         are Unmerged (<literal>U</literal>), are\r
401         Unknown (<literal>X</literal>), or have had their pairing Broken (<literal>B</literal>).\r
402         Any combination of the filter characters may be used.\r
403         When <literal>*</literal> (All-or-none) is added to the combination, all\r
404         paths are selected if there is any file that matches\r
405         other criteria in the comparison; if there is no file\r
406         that matches other criteria, nothing is selected.\r
407 </simpara>\r
408 </listitem>\r
409 </varlistentry>\r
410 <varlistentry>\r
411 <term>\r
412 --find-copies-harder\r
413 </term>\r
414 <listitem>\r
415 <simpara>\r
416         For performance reasons, by default, <literal>-C</literal> option finds copies only\r
417         if the original file of the copy was modified in the same\r
418         changeset.  This flag makes the command\r
419         inspect unmodified files as candidates for the source of\r
420         copy.  This is a very expensive operation for large\r
421         projects, so use it with caution.  Giving more than one\r
422         <literal>-C</literal> option has the same effect.\r
423 </simpara>\r
424 </listitem>\r
425 </varlistentry>\r
426 <varlistentry>\r
427 <term>\r
428 -l&lt;num&gt;\r
429 </term>\r
430 <listitem>\r
431 <simpara>\r
432         -M and -C options require O(n^2) processing time where n\r
433         is the number of potential rename/copy targets.  This\r
434         option prevents rename/copy detection from running if\r
435         the number of rename/copy targets exceeds the specified\r
436         number.\r
437 </simpara>\r
438 </listitem>\r
439 </varlistentry>\r
440 <varlistentry>\r
441 <term>\r
442 -S&lt;string&gt;\r
443 </term>\r
444 <listitem>\r
445 <simpara>\r
446         Look for differences that contain the change in &lt;string&gt;.\r
447 </simpara>\r
448 </listitem>\r
449 </varlistentry>\r
450 <varlistentry>\r
451 <term>\r
452 --pickaxe-all\r
453 </term>\r
454 <listitem>\r
455 <simpara>\r
456         When -S finds a change, show all the changes in that\r
457         changeset, not just the files that contain the change\r
458         in &lt;string&gt;.\r
459 </simpara>\r
460 </listitem>\r
461 </varlistentry>\r
462 <varlistentry>\r
463 <term>\r
464 --pickaxe-regex\r
465 </term>\r
466 <listitem>\r
467 <simpara>\r
468         Make the &lt;string&gt; not a plain string but an extended POSIX\r
469         regex to match.\r
470 </simpara>\r
471 </listitem>\r
472 </varlistentry>\r
473 <varlistentry>\r
474 <term>\r
475 -O&lt;orderfile&gt;\r
476 </term>\r
477 <listitem>\r
478 <simpara>\r
479         Output the patch in the order specified in the\r
480         &lt;orderfile&gt;, which has one shell glob pattern per line.\r
481 </simpara>\r
482 </listitem>\r
483 </varlistentry>\r
484 <varlistentry>\r
485 <term>\r
486 -R\r
487 </term>\r
488 <listitem>\r
489 <simpara>\r
490         Swap two inputs; that is, show differences from index or\r
491         on-disk file to tree contents.\r
492 </simpara>\r
493 </listitem>\r
494 </varlistentry>\r
495 <varlistentry>\r
496 <term>\r
497 --relative[=&lt;path&gt;]\r
498 </term>\r
499 <listitem>\r
500 <simpara>\r
501         When run from a subdirectory of the project, it can be\r
502         told to exclude changes outside the directory and show\r
503         pathnames relative to it with this option.  When you are\r
504         not in a subdirectory (e.g. in a bare repository), you\r
505         can name which subdirectory to make the output relative\r
506         to by giving a &lt;path&gt; as an argument.\r
507 </simpara>\r
508 </listitem>\r
509 </varlistentry>\r
510 <varlistentry>\r
511 <term>\r
512 -a\r
513 </term>\r
514 <term>\r
515 --text\r
516 </term>\r
517 <listitem>\r
518 <simpara>\r
519         Treat all files as text.\r
520 </simpara>\r
521 </listitem>\r
522 </varlistentry>\r
523 <varlistentry>\r
524 <term>\r
525 --ignore-space-at-eol\r
526 </term>\r
527 <listitem>\r
528 <simpara>\r
529         Ignore changes in whitespace at EOL.\r
530 </simpara>\r
531 </listitem>\r
532 </varlistentry>\r
533 <varlistentry>\r
534 <term>\r
535 -b\r
536 </term>\r
537 <term>\r
538 --ignore-space-change\r
539 </term>\r
540 <listitem>\r
541 <simpara>\r
542         Ignore changes in amount of whitespace.  This ignores whitespace\r
543         at line end, and considers all other sequences of one or\r
544         more whitespace characters to be equivalent.\r
545 </simpara>\r
546 </listitem>\r
547 </varlistentry>\r
548 <varlistentry>\r
549 <term>\r
550 -w\r
551 </term>\r
552 <term>\r
553 --ignore-all-space\r
554 </term>\r
555 <listitem>\r
556 <simpara>\r
557         Ignore whitespace when comparing lines.  This ignores\r
558         differences even if one line has whitespace where the other\r
559         line has none.\r
560 </simpara>\r
561 </listitem>\r
562 </varlistentry>\r
563 <varlistentry>\r
564 <term>\r
565 --inter-hunk-context=&lt;lines&gt;\r
566 </term>\r
567 <listitem>\r
568 <simpara>\r
569         Show the context between diff hunks, up to the specified number\r
570         of lines, thereby fusing hunks that are close to each other.\r
571 </simpara>\r
572 </listitem>\r
573 </varlistentry>\r
574 <varlistentry>\r
575 <term>\r
576 --exit-code\r
577 </term>\r
578 <listitem>\r
579 <simpara>\r
580         Make the program exit with codes similar to diff(1).\r
581         That is, it exits with 1 if there were differences and\r
582         0 means no differences.\r
583 </simpara>\r
584 </listitem>\r
585 </varlistentry>\r
586 <varlistentry>\r
587 <term>\r
588 --quiet\r
589 </term>\r
590 <listitem>\r
591 <simpara>\r
592         Disable all output of the program. Implies --exit-code.\r
593 </simpara>\r
594 </listitem>\r
595 </varlistentry>\r
596 <varlistentry>\r
597 <term>\r
598 --ext-diff\r
599 </term>\r
600 <listitem>\r
601 <simpara>\r
602         Allow an external diff helper to be executed. If you set an\r
603         external diff driver with <xref linkend="gitattributes(5)"/>, you need\r
604         to use this option with <xref linkend="git-log(1)"/> and friends.\r
605 </simpara>\r
606 </listitem>\r
607 </varlistentry>\r
608 <varlistentry>\r
609 <term>\r
610 --no-ext-diff\r
611 </term>\r
612 <listitem>\r
613 <simpara>\r
614         Disallow external diff drivers.\r
615 </simpara>\r
616 </listitem>\r
617 </varlistentry>\r
618 <varlistentry>\r
619 <term>\r
620 --ignore-submodules\r
621 </term>\r
622 <listitem>\r
623 <simpara>\r
624         Ignore changes to submodules in the diff generation.\r
625 </simpara>\r
626 </listitem>\r
627 </varlistentry>\r
628 <varlistentry>\r
629 <term>\r
630 --src-prefix=&lt;prefix&gt;\r
631 </term>\r
632 <listitem>\r
633 <simpara>\r
634         Show the given source prefix instead of "a/".\r
635 </simpara>\r
636 </listitem>\r
637 </varlistentry>\r
638 <varlistentry>\r
639 <term>\r
640 --dst-prefix=&lt;prefix&gt;\r
641 </term>\r
642 <listitem>\r
643 <simpara>\r
644         Show the given destination prefix instead of "b/".\r
645 </simpara>\r
646 </listitem>\r
647 </varlistentry>\r
648 <varlistentry>\r
649 <term>\r
650 --no-prefix\r
651 </term>\r
652 <listitem>\r
653 <simpara>\r
654         Do not show any source or destination prefix.\r
655 </simpara>\r
656 </listitem>\r
657 </varlistentry>\r
658 </variablelist>\r
659 <simpara>For more detailed explanation on these common options, see also\r
660 <xref linkend="gitdiffcore(7)"/>.</simpara>\r
661 <variablelist>\r
662 <varlistentry>\r
663 <term>\r
664 -&lt;n&gt;\r
665 </term>\r
666 <listitem>\r
667 <simpara>\r
668         Limits the number of patches to prepare.\r
669 </simpara>\r
670 </listitem>\r
671 </varlistentry>\r
672 <varlistentry>\r
673 <term>\r
674 -o &lt;dir&gt;\r
675 </term>\r
676 <term>\r
677 --output-directory &lt;dir&gt;\r
678 </term>\r
679 <listitem>\r
680 <simpara>\r
681         Use &lt;dir&gt; to store the resulting files, instead of the\r
682         current working directory.\r
683 </simpara>\r
684 </listitem>\r
685 </varlistentry>\r
686 <varlistentry>\r
687 <term>\r
688 -n\r
689 </term>\r
690 <term>\r
691 --numbered\r
692 </term>\r
693 <listitem>\r
694 <simpara>\r
695         Name output in <emphasis>[PATCH n/m]</emphasis> format, even with a single patch.\r
696 </simpara>\r
697 </listitem>\r
698 </varlistentry>\r
699 <varlistentry>\r
700 <term>\r
701 -N\r
702 </term>\r
703 <term>\r
704 --no-numbered\r
705 </term>\r
706 <listitem>\r
707 <simpara>\r
708         Name output in <emphasis>[PATCH]</emphasis> format.\r
709 </simpara>\r
710 </listitem>\r
711 </varlistentry>\r
712 <varlistentry>\r
713 <term>\r
714 --start-number &lt;n&gt;\r
715 </term>\r
716 <listitem>\r
717 <simpara>\r
718         Start numbering the patches at &lt;n&gt; instead of 1.\r
719 </simpara>\r
720 </listitem>\r
721 </varlistentry>\r
722 <varlistentry>\r
723 <term>\r
724 --numbered-files\r
725 </term>\r
726 <listitem>\r
727 <simpara>\r
728         Output file names will be a simple number sequence\r
729         without the default first line of the commit appended.\r
730         Mutually exclusive with the --stdout option.\r
731 </simpara>\r
732 </listitem>\r
733 </varlistentry>\r
734 <varlistentry>\r
735 <term>\r
736 -k\r
737 </term>\r
738 <term>\r
739 --keep-subject\r
740 </term>\r
741 <listitem>\r
742 <simpara>\r
743         Do not strip/add <emphasis>[PATCH]</emphasis> from the first line of the\r
744         commit log message.\r
745 </simpara>\r
746 </listitem>\r
747 </varlistentry>\r
748 <varlistentry>\r
749 <term>\r
750 -s\r
751 </term>\r
752 <term>\r
753 --signoff\r
754 </term>\r
755 <listitem>\r
756 <simpara>\r
757         Add <literal>Signed-off-by:</literal> line to the commit message, using\r
758         the committer identity of yourself.\r
759 </simpara>\r
760 </listitem>\r
761 </varlistentry>\r
762 <varlistentry>\r
763 <term>\r
764 --stdout\r
765 </term>\r
766 <listitem>\r
767 <simpara>\r
768         Print all commits to the standard output in mbox format,\r
769         instead of creating a file for each one.\r
770 </simpara>\r
771 </listitem>\r
772 </varlistentry>\r
773 <varlistentry>\r
774 <term>\r
775 --attach[=&lt;boundary&gt;]\r
776 </term>\r
777 <listitem>\r
778 <simpara>\r
779         Create multipart/mixed attachment, the first part of\r
780         which is the commit message and the patch itself in the\r
781         second part, with "Content-Disposition: attachment".\r
782 </simpara>\r
783 </listitem>\r
784 </varlistentry>\r
785 <varlistentry>\r
786 <term>\r
787 --inline[=&lt;boundary&gt;]\r
788 </term>\r
789 <listitem>\r
790 <simpara>\r
791         Create multipart/mixed attachment, the first part of\r
792         which is the commit message and the patch itself in the\r
793         second part, with "Content-Disposition: inline".\r
794 </simpara>\r
795 </listitem>\r
796 </varlistentry>\r
797 <varlistentry>\r
798 <term>\r
799 --thread\r
800 </term>\r
801 <listitem>\r
802 <simpara>\r
803         Add In-Reply-To and References headers to make the second and\r
804         subsequent mails appear as replies to the first.  Also generates\r
805         the Message-Id header to reference.\r
806 </simpara>\r
807 </listitem>\r
808 </varlistentry>\r
809 <varlistentry>\r
810 <term>\r
811 --in-reply-to=Message-Id\r
812 </term>\r
813 <listitem>\r
814 <simpara>\r
815         Make the first mail (or all the mails with --no-thread) appear as a\r
816         reply to the given Message-Id, which avoids breaking threads to\r
817         provide a new patch series.\r
818 </simpara>\r
819 </listitem>\r
820 </varlistentry>\r
821 <varlistentry>\r
822 <term>\r
823 --ignore-if-in-upstream\r
824 </term>\r
825 <listitem>\r
826 <simpara>\r
827         Do not include a patch that matches a commit in\r
828         &lt;until&gt;..&lt;since&gt;.  This will examine all patches reachable\r
829         from &lt;since&gt; but not from &lt;until&gt; and compare them with the\r
830         patches being generated, and any patch that matches is\r
831         ignored.\r
832 </simpara>\r
833 </listitem>\r
834 </varlistentry>\r
835 <varlistentry>\r
836 <term>\r
837 --subject-prefix=&lt;Subject-Prefix&gt;\r
838 </term>\r
839 <listitem>\r
840 <simpara>\r
841         Instead of the standard <emphasis>[PATCH]</emphasis> prefix in the subject\r
842         line, instead use <emphasis>[&lt;Subject-Prefix&gt;]</emphasis>. This\r
843         allows for useful naming of a patch series, and can be\r
844         combined with the --numbered option.\r
845 </simpara>\r
846 </listitem>\r
847 </varlistentry>\r
848 <varlistentry>\r
849 <term>\r
850 --cc=&lt;email&gt;\r
851 </term>\r
852 <listitem>\r
853 <simpara>\r
854         Add a "Cc:" header to the email headers. This is in addition\r
855         to any configured headers, and may be used multiple times.\r
856 </simpara>\r
857 </listitem>\r
858 </varlistentry>\r
859 <varlistentry>\r
860 <term>\r
861 --cover-letter\r
862 </term>\r
863 <listitem>\r
864 <simpara>\r
865         In addition to the patches, generate a cover letter file\r
866         containing the shortlog and the overall diffstat.  You can\r
867         fill in a description in the file before sending it out.\r
868 </simpara>\r
869 </listitem>\r
870 </varlistentry>\r
871 <varlistentry>\r
872 <term>\r
873 --suffix=.&lt;sfx&gt;\r
874 </term>\r
875 <listitem>\r
876 <simpara>\r
877         Instead of using <literal>.patch</literal> as the suffix for generated\r
878         filenames, use specified suffix.  A common alternative is\r
879         <literal>--suffix=.txt</literal>.\r
880 </simpara>\r
881 <simpara>Note that you would need to include the leading dot <literal>.</literal> if you\r
882 want a filename like <literal>0001-description-of-my-change.patch</literal>, and\r
883 the first letter does not have to be a dot.  Leaving it empty would\r
884 not add any suffix.</simpara>\r
885 </listitem>\r
886 </varlistentry>\r
887 <varlistentry>\r
888 <term>\r
889 --no-binary\r
890 </term>\r
891 <listitem>\r
892 <simpara>\r
893         Don&#8217;t output contents of changes in binary files, just take note\r
894         that they differ.  Note that this disable the patch to be properly\r
895         applied.  By default the contents of changes in those files are\r
896         encoded in the patch.\r
897 </simpara>\r
898 </listitem>\r
899 </varlistentry>\r
900 </variablelist>\r
901 </simplesect>\r
902 <simplesect id="_configuration">\r
903 <title>CONFIGURATION</title>\r
904 <simpara>You can specify extra mail header lines to be added to each message\r
905 in the repository configuration, new defaults for the subject prefix\r
906 and file suffix, and number patches when outputting more than one.</simpara>\r
907 <literallayout>[format]\r
908         headers = "Organization: git-foo\n"\r
909         subjectprefix = CHANGE\r
910         suffix = .txt\r
911         numbered = auto\r
912         cc = &lt;email&gt;</literallayout>\r
913 </simplesect>\r
914 <simplesect id="_examples">\r
915 <title>EXAMPLES</title>\r
916 <itemizedlist>\r
917 <listitem>\r
918 <simpara>\r
919 Extract commits between revisions R1 and R2, and apply them on top of\r
920 the current branch using <emphasis>git-am</emphasis> to cherry-pick them:\r
921 </simpara>\r
922 <literallayout>$ git format-patch -k --stdout R1..R2 | git am -3 -k</literallayout>\r
923 </listitem>\r
924 <listitem>\r
925 <simpara>\r
926 Extract all commits which are in the current branch but not in the\r
927 origin branch:\r
928 </simpara>\r
929 <literallayout>$ git format-patch origin</literallayout>\r
930 <simpara>For each commit a separate file is created in the current directory.</simpara>\r
931 </listitem>\r
932 <listitem>\r
933 <simpara>\r
934 Extract all commits that lead to <emphasis>origin</emphasis> since the inception of the\r
935 project:\r
936 </simpara>\r
937 <literallayout>$ git format-patch --root origin</literallayout>\r
938 </listitem>\r
939 <listitem>\r
940 <simpara>\r
941 The same as the previous one:\r
942 </simpara>\r
943 <literallayout>$ git format-patch -M -B origin</literallayout>\r
944 <simpara>Additionally, it detects and handles renames and complete rewrites\r
945 intelligently to produce a renaming patch.  A renaming patch reduces\r
946 the amount of text output, and generally makes it easier to review it.\r
947 Note that the "patch" program does not understand renaming patches, so\r
948 use it only when you know the recipient uses git to apply your patch.</simpara>\r
949 </listitem>\r
950 <listitem>\r
951 <simpara>\r
952 Extract three topmost commits from the current branch and format them\r
953 as e-mailable patches:\r
954 </simpara>\r
955 <literallayout>$ git format-patch -3</literallayout>\r
956 </listitem>\r
957 </itemizedlist>\r
958 </simplesect>\r
959 <simplesect id="_see_also">\r
960 <title>SEE ALSO</title>\r
961 <simpara><xref linkend="git-am(1)"/>, <xref linkend="git-send-email(1)"/></simpara>\r
962 </simplesect>\r
963 <simplesect id="_author">\r
964 <title>Author</title>\r
965 <simpara>Written by Junio C Hamano &lt;<ulink url="mailto:gitster@pobox.com">gitster@pobox.com</ulink>&gt;</simpara>\r
966 </simplesect>\r
967 <simplesect id="_documentation">\r
968 <title>Documentation</title>\r
969 <simpara>Documentation by Junio C Hamano and the git-list &lt;<ulink url="mailto:git@vger.kernel.org">git@vger.kernel.org</ulink>&gt;.</simpara>\r
970 </simplesect>\r
971 <simplesect id="_git">\r
972 <title>GIT</title>\r
973 <simpara>Part of the <xref linkend="git(1)"/> suite</simpara>\r
974 </simplesect>\r
975 </article>\r