1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en">
6 <meta http-equiv=
"Content-Type" content=
"application/xhtml+xml; charset=UTF-8" />
7 <meta name=
"generator" content=
"AsciiDoc 10.2.0" />
8 <title>git-format-patch(
1)
</title>
9 <style type=
"text/css">
10 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
14 font-family: Georgia,serif;
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
22 #author, #revnumber, #revdate, #revremark,
24 font-family: Arial,Helvetica,sans-serif;
28 margin:
1em
5%
1em
5%;
33 text-decoration: underline;
49 h1, h2, h3, h4, h5, h6 {
57 border-bottom:
2px solid silver;
77 border:
1px solid silver;
88 ul
> li { color: #aaa; }
89 ul
> li
> * { color: black; }
91 .monospaced, code, pre {
92 font-family:
"Courier New", Courier, monospace;
99 white-space: pre-wrap;
109 #revnumber, #revdate, #revremark {
114 border-top:
2px solid silver;
120 padding-bottom:
0.5em;
124 padding-bottom:
0.5em;
129 margin-bottom:
1.5em;
131 div.imageblock, div.exampleblock, div.verseblock,
132 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133 div.admonitionblock {
135 margin-bottom:
1.5em;
137 div.admonitionblock {
139 margin-bottom:
2.0em;
144 div.content { /* Block element content. */
148 /* Block element titles. */
149 div.title, caption.title {
154 margin-bottom:
0.5em;
160 td div.title:first-child {
163 div.content div.title:first-child {
166 div.content + div.title {
170 div.sidebarblock
> div.content {
172 border:
1px solid #dddddd;
173 border-left:
4px solid #f0f0f0;
177 div.listingblock
> div.content {
178 border:
1px solid #dddddd;
179 border-left:
5px solid #f0f0f0;
184 div.quoteblock, div.verseblock {
188 border-left:
5px solid #f0f0f0;
192 div.quoteblock
> div.attribution {
197 div.verseblock
> pre.content {
198 font-family: inherit;
201 div.verseblock
> div.attribution {
205 /* DEPRECATED: Pre version
8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
210 div.admonitionblock .icon {
214 text-decoration: underline;
216 padding-right:
0.5em;
218 div.admonitionblock td.content {
220 border-left:
3px solid #dddddd;
223 div.exampleblock
> div.content {
224 border-left:
3px solid #dddddd;
228 div.imageblock div.content { padding-left:
0; }
229 span.image img { border-style: none; vertical-align: text-bottom; }
230 a.image:visited { color: white; }
234 margin-bottom:
0.8em;
247 list-style-position: outside;
250 list-style-type: decimal;
253 list-style-type: lower-alpha;
256 list-style-type: upper-alpha;
259 list-style-type: lower-roman;
262 list-style-type: upper-roman;
265 div.compact ul, div.compact ol,
266 div.compact p, div.compact p,
267 div.compact div, div.compact div {
269 margin-bottom:
0.1em;
281 margin-bottom:
0.8em;
284 padding-bottom:
15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
292 padding-right:
0.8em;
298 div.hdlist.compact tr {
307 .footnote, .footnoteref {
311 span.footnote, span.footnoteref {
312 vertical-align: super;
316 margin:
20px
0 20px
0;
320 #footnotes div.footnote {
326 border-top:
1px solid silver;
335 padding-right:
0.5em;
336 padding-bottom:
0.3em;
344 #footer-badges { display: none; }
348 margin-bottom:
2.5em;
356 margin-bottom:
0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
376 span.aqua { color: aqua; }
377 span.black { color: black; }
378 span.blue { color: blue; }
379 span.fuchsia { color: fuchsia; }
380 span.gray { color: gray; }
381 span.green { color: green; }
382 span.lime { color: lime; }
383 span.maroon { color: maroon; }
384 span.navy { color: navy; }
385 span.olive { color: olive; }
386 span.purple { color: purple; }
387 span.red { color: red; }
388 span.silver { color: silver; }
389 span.teal { color: teal; }
390 span.white { color: white; }
391 span.yellow { color: yellow; }
393 span.aqua-background { background: aqua; }
394 span.black-background { background: black; }
395 span.blue-background { background: blue; }
396 span.fuchsia-background { background: fuchsia; }
397 span.gray-background { background: gray; }
398 span.green-background { background: green; }
399 span.lime-background { background: lime; }
400 span.maroon-background { background: maroon; }
401 span.navy-background { background: navy; }
402 span.olive-background { background: olive; }
403 span.purple-background { background: purple; }
404 span.red-background { background: red; }
405 span.silver-background { background: silver; }
406 span.teal-background { background: teal; }
407 span.white-background { background: white; }
408 span.yellow-background { background: yellow; }
410 span.big { font-size:
2em; }
411 span.small { font-size:
0.6em; }
413 span.underline { text-decoration: underline; }
414 span.overline { text-decoration: overline; }
415 span.line-through { text-decoration: line-through; }
417 div.unbreakable { page-break-inside: avoid; }
427 margin-bottom:
1.5em;
429 div.tableblock
> table {
430 border:
3px solid #
527bbd;
432 thead, p.table.header {
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock
> table[
frame=
"void"] {
443 div.tableblock
> table[
frame=
"hsides"] {
444 border-left-style: none;
445 border-right-style: none;
447 div.tableblock
> table[
frame=
"vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
460 margin-bottom:
1.5em;
462 thead, p.tableblock.header {
473 border-color: #
527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
480 border-color: #
527bbd;
483 table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
487 table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
491 table.tableblock.frame-none {
492 border-style: hidden;
495 th.tableblock.halign-left, td.tableblock.halign-left {
498 th.tableblock.halign-center, td.tableblock.halign-center {
501 th.tableblock.halign-right, td.tableblock.halign-right {
505 th.tableblock.valign-top, td.tableblock.valign-top {
508 th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
511 th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
523 padding-bottom:
0.5em;
524 border-top:
2px solid silver;
525 border-bottom:
2px solid silver;
530 body.manpage div.sectionbody {
535 body.manpage div#toc { display: none; }
540 <script type=
"text/javascript">
542 var asciidoc = { // Namespace.
544 /////////////////////////////////////////////////////////////////////
545 // Table Of Contents generator
546 /////////////////////////////////////////////////////////////////////
548 /* Author: Mihai Bazon, September
2002
549 * http://students.infoiasi.ro/~mishoo
551 * Table Of Content generator
554 * Feel free to use this script under the terms of the GNU General Public
555 * License, as long as you do not remove or alter this notice.
558 /* modified by Troy D. Hanson, September
2006. License: GPL */
559 /* modified by Stuart Rackham,
2006,
2009. License: GPL */
562 toc: function (toclevels) {
564 function getText(el) {
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType ==
3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
569 else if (i.firstChild != null)
575 function TocEntry(el, text, toclevel) {
578 this.toclevel = toclevel;
581 function tocEntries(el, toclevels) {
582 var result = new Array;
583 var re = new RegExp('[hH]([
1-'+(toclevels+
1)+'])');
584 // Function that scans the DOM tree for header elements (the DOM2
585 // nodeIterator API would be a better technique but not supported by all
587 var iterate = function (el) {
588 for (var i = el.firstChild; i != null; i = i.nextSibling) {
589 if (i.nodeType ==
1 /* Node.ELEMENT_NODE */) {
590 var mo = re.exec(i.tagName);
591 if (mo && (i.getAttribute(
"class") || i.getAttribute(
"className")) !=
"float") {
592 result[result.length] = new TocEntry(i, getText(i), mo[
1]-
1);
602 var toc = document.getElementById(
"toc");
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
610 for (i =
0; i < toc.childNodes.length; i++) {
611 var entry = toc.childNodes[i];
612 if (entry.nodeName.toLowerCase() == 'div'
613 && entry.getAttribute(
"class")
614 && entry.getAttribute(
"class").match(/^toclevel/))
615 tocEntriesToRemove.push(entry);
617 for (i =
0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
621 // Rebuild TOC entries.
622 var entries = tocEntries(document.getElementById(
"content"), toclevels);
623 for (var i =
0; i < entries.length; ++i) {
624 var entry = entries[i];
625 if (entry.element.id ==
"")
626 entry.element.id =
"_toc_" + i;
627 var a = document.createElement(
"a");
628 a.href =
"#" + entry.element.id;
629 a.appendChild(document.createTextNode(entry.text));
630 var div = document.createElement(
"div");
632 div.className =
"toclevel" + entry.toclevel;
633 toc.appendChild(div);
635 if (entries.length ==
0)
636 toc.parentNode.removeChild(toc);
640 /////////////////////////////////////////////////////////////////////
641 // Footnotes generator
642 /////////////////////////////////////////////////////////////////////
644 /* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/
2005/
07/format_footnote.html
648 footnotes: function () {
649 // Delete existing footnote entries in case we're reloading the footnodes.
651 var noteholder = document.getElementById(
"footnotes");
655 var entriesToRemove = [];
656 for (i =
0; i < noteholder.childNodes.length; i++) {
657 var entry = noteholder.childNodes[i];
658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute(
"class") ==
"footnote")
659 entriesToRemove.push(entry);
661 for (i =
0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
665 // Rebuild footnote entries.
666 var cont = document.getElementById(
"content");
667 var spans = cont.getElementsByTagName(
"span");
670 for (i=
0; i
<spans.length; i++) {
671 if (spans[i].className ==
"footnote") {
673 var note = spans[i].getAttribute(
"data-note");
675 // Use [\s\S] in place of . so multi-line matches work.
676 // Because JavaScript has no s (dotall) regex flag.
677 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[
1];
679 "[<a id='_footnoteref_" + n +
"' href='#_footnote_" + n +
680 "' title='View footnote' class='footnote'>" + n +
"</a>]";
681 spans[i].setAttribute(
"data-note", note);
683 noteholder.innerHTML +=
684 "<div class='footnote' id='_footnote_" + n +
"'>" +
685 "<a href='#_footnoteref_" + n +
"' title='Return to text'>" +
686 n +
"</a>. " + note +
"</div>";
687 var id =spans[i].getAttribute(
"id");
688 if (id != null) refs[
"#"+id] = n;
692 noteholder.parentNode.removeChild(noteholder);
694 // Process footnoterefs.
695 for (i=
0; i
<spans.length; i++) {
696 if (spans[i].className ==
"footnoteref") {
697 var href = spans[i].getElementsByTagName(
"a")[
0].getAttribute(
"href");
698 href = href.match(/#.*/)[
0]; // Because IE return full URL.
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n +
"</a>]";
708 install: function(toclevels) {
711 function reinstall() {
712 asciidoc.footnotes();
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
723 timerId = setInterval(reinstall,
500);
724 if (document.addEventListener)
725 document.addEventListener(
"DOMContentLoaded", reinstallAndRemoveTimer, false);
727 window.onload = reinstallAndRemoveTimer;
735 <body class=
"manpage">
738 git-format-patch(
1) Manual Page
741 <div class=
"sectionbody">
742 <p>git-format-patch -
743 Prepare patches for e-mail submission
749 <h2 id=
"_synopsis">SYNOPSIS
</h2>
750 <div class=
"sectionbody">
751 <div class=
"verseblock">
752 <pre class=
"content"><em>git format-patch
</em> [-k] [(-o|--output-directory)
<dir
> | --stdout]
753 [--no-thread | --thread[=
<style
>]]
754 [(--attach|--inline)[=
<boundary
>] | --no-attach]
756 [--signature=
<signature
> | --no-signature]
757 [--signature-file=
<file
>]
758 [-n | --numbered | -N | --no-numbered]
759 [--start-number
<n
>] [--numbered-files]
760 [--in-reply-to=
<message-id
>] [--suffix=.
<sfx
>]
761 [--ignore-if-in-upstream] [--always]
762 [--cover-from-description=
<mode
>]
763 [--rfc] [--subject-prefix=
<subject-prefix
>]
764 [(--reroll-count|-v)
<n
>]
765 [--to=
<email
>] [--cc=
<email
>]
766 [--[no-]cover-letter] [--quiet]
767 [--[no-]encode-email-headers]
768 [--no-notes | --notes[=
<ref
>]]
769 [--interdiff=
<previous
>]
770 [--range-diff=
<previous
> [--creation-factor=
<percent
>]]
771 [--filename-max-length=
<n
>]
773 [
<common-diff-options
>]
774 [
<since
> |
<revision-range
> ]
</pre>
775 <div class=
"attribution">
780 <h2 id=
"_description">DESCRIPTION
</h2>
781 <div class=
"sectionbody">
782 <div class=
"paragraph"><p>Prepare each non-merge commit with its
"patch" in
783 one
"message" per commit, formatted to resemble a UNIX mailbox.
784 The output of this command is convenient for e-mail submission or
785 for use with
<em>git am
</em>.
</p></div>
786 <div class=
"paragraph"><p>A
"message" generated by the command consists of three parts:
</p></div>
787 <div class=
"ulist"><ul>
790 A brief metadata header that begins with
<code>From
<commit
></code>
791 with a fixed
<code>Mon Sep
17 00:
00:
00 2001</code> datestamp to help programs
792 like
"file(1)" to recognize that the file is an output from this
793 command, fields that record the author identity, the author date,
794 and the title of the change (taken from the first paragraph of the
800 The second and subsequent paragraphs of the commit log message.
805 The
"patch", which is the
"diff -p --stat" output (see
806 <a href=
"git-diff.html">git-diff(
1)
</a>) between the commit and its parent.
810 <div class=
"paragraph"><p>The log message and the patch are separated by a line with a
811 three-dash line.
</p></div>
812 <div class=
"paragraph"><p>There are two ways to specify which commits to operate on.
</p></div>
813 <div class=
"olist arabic"><ol class=
"arabic">
816 A single commit,
<since
>, specifies that the commits leading
817 to the tip of the current branch that are not in the history
818 that leads to the
<since
> to be output.
823 Generic
<revision-range
> expression (see
"SPECIFYING
824 REVISIONS" section in
<a href=
"gitrevisions.html">gitrevisions(
7)
</a>) means the
825 commits in the specified range.
829 <div class=
"paragraph"><p>The first rule takes precedence in the case of a single
<commit
>. To
830 apply the second rule, i.e., format everything since the beginning of
831 history up until
<commit
>, use the
<code>--root
</code> option:
<code>git format-patch
832 --root
<commit
></code>. If you want to format only
<commit
> itself, you
833 can do this with
<code>git format-patch -
1 <commit
></code>.
</p></div>
834 <div class=
"paragraph"><p>By default, each output file is numbered sequentially from
1, and uses the
835 first line of the commit message (massaged for pathname safety) as
836 the filename. With the
<code>--numbered-files
</code> option, the output file names
837 will only be numbers, without the first line of the commit appended.
838 The names of the output files are printed to standard
839 output, unless the
<code>--stdout
</code> option is specified.
</p></div>
840 <div class=
"paragraph"><p>If
<code>-o
</code> is specified, output files are created in
<dir
>. Otherwise
841 they are created in the current working directory. The default path
842 can be set with the
<code>format.outputDirectory
</code> configuration option.
843 The
<code>-o
</code> option takes precedence over
<code>format.outputDirectory
</code>.
844 To store patches in the current working directory even when
845 <code>format.outputDirectory
</code> points elsewhere, use
<code>-o .
</code>. All directory
846 components will be created.
</p></div>
847 <div class=
"paragraph"><p>By default, the subject of a single patch is
"[PATCH] " followed by
848 the concatenation of lines from the commit message up to the first blank
849 line (see the DISCUSSION section of
<a href=
"git-commit.html">git-commit(
1)
</a>).
</p></div>
850 <div class=
"paragraph"><p>When multiple patches are output, the subject prefix will instead be
851 "[PATCH n/m] ". To force
1/
1 to be added for a single patch, use
<code>-n
</code>.
852 To omit patch numbers from the subject, use
<code>-N
</code>.
</p></div>
853 <div class=
"paragraph"><p>If given
<code>--thread
</code>,
<code>git-format-patch
</code> will generate
<code>In-Reply-To
</code> and
854 <code>References
</code> headers to make the second and subsequent patch mails appear
855 as replies to the first mail; this also generates a
<code>Message-ID
</code> header to
860 <h2 id=
"_options">OPTIONS
</h2>
861 <div class=
"sectionbody">
862 <div class=
"dlist"><dl>
871 Generate plain patches without any diffstats.
882 Generate diffs with
<n
> lines of context instead of
887 --output=
<file
>
891 Output to a specific file instead of stdout.
895 --output-indicator-new=
<char
>
898 --output-indicator-old=
<char
>
901 --output-indicator-context=
<char
>
905 Specify the character used to indicate new, old or context
906 lines in the generated patch. Normally they are
<em>+
</em>,
<em>-
</em> and
915 Enable the heuristic that shifts diff hunk boundaries to make patches
916 easier to read. This is the default.
920 --no-indent-heuristic
924 Disable the indent heuristic.
932 Spend extra time to make sure the smallest possible
941 Generate a diff using the
"patience diff" algorithm.
949 Generate a diff using the
"histogram diff" algorithm.
953 --anchored=
<text
>
957 Generate a diff using the
"anchored diff" algorithm.
959 <div class=
"paragraph"><p>This option may be specified more than once.
</p></div>
960 <div class=
"paragraph"><p>If a line exists in both the source and destination, exists only once,
961 and starts with this text, this algorithm attempts to prevent it from
962 appearing as a deletion or addition in the output. It uses the
"patience
963 diff" algorithm internally.
</p></div>
966 --diff-algorithm={patience|minimal|histogram|myers}
970 Choose a diff algorithm. The variants are as follows:
972 <div class=
"openblock">
973 <div class=
"content">
974 <div class=
"dlist"><dl>
976 <code>default
</code>,
<code>myers
</code>
980 The basic greedy diff algorithm. Currently, this is the default.
988 Spend extra time to make sure the smallest possible diff is
993 <code>patience
</code>
997 Use
"patience diff" algorithm when generating patches.
1000 <dt class=
"hdlist1">
1001 <code>histogram
</code>
1005 This algorithm extends the patience algorithm to
"support
1006 low-occurrence common elements".
1011 <div class=
"paragraph"><p>For instance, if you configured the
<code>diff.algorithm
</code> variable to a
1012 non-default value and want to use the default one, then you
1013 have to use
<code>--diff-algorithm=default
</code> option.
</p></div>
1015 <dt class=
"hdlist1">
1016 --stat[=
<width
>[,
<name-width
>[,
<count
>]]]
1020 Generate a diffstat. By default, as much space as necessary
1021 will be used for the filename part, and the rest for the graph
1022 part. Maximum width defaults to terminal width, or
80 columns
1023 if not connected to a terminal, and can be overridden by
1024 <code><width
></code>. The width of the filename part can be limited by
1025 giving another width
<code><name-width
></code> after a comma or by setting
1026 <code>diff.statNameWidth=
<width
></code>. The width of the graph part can be
1027 limited by using
<code>--stat-graph-width=
<width
></code> or by setting
1028 <code>diff.statGraphWidth=
<width
></code>. Using
<code>--stat
</code> or
1029 <code>--stat-graph-width
</code> affects all commands generating a stat graph,
1030 while setting
<code>diff.statNameWidth
</code> or
<code>diff.statGraphWidth
</code>
1031 does not affect
<code>git format-patch
</code>.
1032 By giving a third parameter
<code><count
></code>, you can limit the output to
1033 the first
<code><count
></code> lines, followed by
<code>...
</code> if there are more.
1035 <div class=
"paragraph"><p>These parameters can also be set individually with
<code>--stat-width=
<width
></code>,
1036 <code>--stat-name-width=
<name-width
></code> and
<code>--stat-count=
<count
></code>.
</p></div>
1038 <dt class=
"hdlist1">
1043 Output a condensed summary of extended header information such
1044 as file creations or deletions (
"new" or
"gone", optionally
"+l"
1045 if it
’s a symlink) and mode changes (
"+x" or
"-x" for adding
1046 or removing executable bit respectively) in diffstat. The
1047 information is put between the filename part and the graph
1048 part. Implies
<code>--stat
</code>.
1051 <dt class=
"hdlist1">
1056 Similar to
<code>--stat
</code>, but shows number of added and
1057 deleted lines in decimal notation and pathname without
1058 abbreviation, to make it more machine friendly. For
1059 binary files, outputs two
<code>-
</code> instead of saying
1063 <dt class=
"hdlist1">
1068 Output only the last line of the
<code>--stat
</code> format containing total
1069 number of modified files, as well as number of added and deleted
1073 <dt class=
"hdlist1">
1074 -X[
<param1,param2,
…>]
1076 <dt class=
"hdlist1">
1077 --dirstat[=
<param1,param2,
…>]
1081 Output the distribution of relative amount of changes for each
1082 sub-directory. The behavior of
<code>--dirstat
</code> can be customized by
1083 passing it a comma separated list of parameters.
1084 The defaults are controlled by the
<code>diff.dirstat
</code> configuration
1085 variable (see
<a href=
"git-config.html">git-config(
1)
</a>).
1086 The following parameters are available:
1088 <div class=
"openblock">
1089 <div class=
"content">
1090 <div class=
"dlist"><dl>
1091 <dt class=
"hdlist1">
1092 <code>changes
</code>
1096 Compute the dirstat numbers by counting the lines that have been
1097 removed from the source, or added to the destination. This ignores
1098 the amount of pure code movements within a file. In other words,
1099 rearranging lines in a file is not counted as much as other changes.
1100 This is the default behavior when no parameter is given.
1103 <dt class=
"hdlist1">
1108 Compute the dirstat numbers by doing the regular line-based diff
1109 analysis, and summing the removed/added line counts. (For binary
1110 files, count
64-byte chunks instead, since binary files have no
1111 natural concept of lines). This is a more expensive
<code>--dirstat
</code>
1112 behavior than the
<code>changes
</code> behavior, but it does count rearranged
1113 lines within a file as much as other changes. The resulting output
1114 is consistent with what you get from the other
<code>--*stat
</code> options.
1117 <dt class=
"hdlist1">
1122 Compute the dirstat numbers by counting the number of files changed.
1123 Each changed file counts equally in the dirstat analysis. This is
1124 the computationally cheapest
<code>--dirstat
</code> behavior, since it does
1125 not have to look at the file contents at all.
1128 <dt class=
"hdlist1">
1129 <code>cumulative
</code>
1133 Count changes in a child directory for the parent directory as well.
1134 Note that when using
<code>cumulative
</code>, the sum of the percentages
1135 reported may exceed
100%. The default (non-cumulative) behavior can
1136 be specified with the
<code>noncumulative
</code> parameter.
1139 <dt class=
"hdlist1">
1144 An integer parameter specifies a cut-off percent (
3% by default).
1145 Directories contributing less than this percentage of the changes
1146 are not shown in the output.
1151 <div class=
"paragraph"><p>Example: The following will count changed files, while ignoring
1152 directories with less than
10% of the total amount of changed files,
1153 and accumulating child directory counts in the parent directories:
1154 <code>--dirstat=files,
10,cumulative
</code>.
</p></div>
1156 <dt class=
"hdlist1">
1161 Synonym for --dirstat=cumulative
1164 <dt class=
"hdlist1">
1165 --dirstat-by-file[=
<param1,param2
>…]
1169 Synonym for --dirstat=files,
<param1
>,
<param2
>…
1172 <dt class=
"hdlist1">
1177 Output a condensed summary of extended header information
1178 such as creations, renames and mode changes.
1181 <dt class=
"hdlist1">
1186 Turn off rename detection, even when the configuration
1187 file gives the default to do so.
1190 <dt class=
"hdlist1">
1195 Whether to use empty blobs as rename source.
1198 <dt class=
"hdlist1">
1203 Instead of the first handful of characters, show the full
1204 pre- and post-image blob object names on the
"index"
1205 line when generating patch format output.
1208 <dt class=
"hdlist1">
1213 In addition to
<code>--full-index
</code>, output a binary diff that
1214 can be applied with
<code>git-apply
</code>.
1217 <dt class=
"hdlist1">
1218 --abbrev[=
<n
>]
1222 Instead of showing the full
40-byte hexadecimal object
1223 name in diff-raw format output and diff-tree header
1224 lines, show the shortest prefix that is at least
<em><n
></em>
1225 hexdigits long that uniquely refers the object.
1226 In diff-patch output format,
<code>--full-index
</code> takes higher
1227 precedence, i.e. if
<code>--full-index
</code> is specified, full blob
1228 names will be shown regardless of
<code>--abbrev
</code>.
1229 Non default number of digits can be specified with
<code>--abbrev=
<n
></code>.
1232 <dt class=
"hdlist1">
1233 -B[
<n
>][/
<m
>]
1235 <dt class=
"hdlist1">
1236 --break-rewrites[=[
<n
>][/
<m
>]]
1240 Break complete rewrite changes into pairs of delete and
1241 create. This serves two purposes:
1243 <div class=
"paragraph"><p>It affects the way a change that amounts to a total rewrite of a file
1244 not as a series of deletion and insertion mixed together with a very
1245 few lines that happen to match textually as the context, but as a
1246 single deletion of everything old followed by a single insertion of
1247 everything new, and the number
<code>m
</code> controls this aspect of the -B
1248 option (defaults to
60%).
<code>-B/
70%
</code> specifies that less than
30% of the
1249 original should remain in the result for Git to consider it a total
1250 rewrite (i.e. otherwise the resulting patch will be a series of
1251 deletion and insertion mixed together with context lines).
</p></div>
1252 <div class=
"paragraph"><p>When used with -M, a totally-rewritten file is also considered as the
1253 source of a rename (usually -M only considers a file that disappeared
1254 as the source of a rename), and the number
<code>n
</code> controls this aspect of
1255 the -B option (defaults to
50%).
<code>-B20%
</code> specifies that a change with
1256 addition and deletion compared to
20% or more of the file
’s size are
1257 eligible for being picked up as a possible source of a rename to
1258 another file.
</p></div>
1260 <dt class=
"hdlist1">
1263 <dt class=
"hdlist1">
1264 --find-renames[=
<n
>]
1269 If
<code>n
</code> is specified, it is a threshold on the similarity
1270 index (i.e. amount of addition/deletions compared to the
1271 file
’s size). For example,
<code>-M90%
</code> means Git should consider a
1272 delete/add pair to be a rename if more than
90% of the file
1273 hasn
’t changed. Without a
<code>%
</code> sign, the number is to be read as
1274 a fraction, with a decimal point before it. I.e.,
<code>-M5
</code> becomes
1275 0.5, and is thus the same as
<code>-M50%
</code>. Similarly,
<code>-M05
</code> is
1276 the same as
<code>-M5%
</code>. To limit detection to exact renames, use
1277 <code>-M100%
</code>. The default similarity index is
50%.
1280 <dt class=
"hdlist1">
1283 <dt class=
"hdlist1">
1284 --find-copies[=
<n
>]
1288 Detect copies as well as renames. See also
<code>--find-copies-harder
</code>.
1289 If
<code>n
</code> is specified, it has the same meaning as for
<code>-M
<n
></code>.
1292 <dt class=
"hdlist1">
1293 --find-copies-harder
1297 For performance reasons, by default,
<code>-C
</code> option finds copies only
1298 if the original file of the copy was modified in the same
1299 changeset. This flag makes the command
1300 inspect unmodified files as candidates for the source of
1301 copy. This is a very expensive operation for large
1302 projects, so use it with caution. Giving more than one
1303 <code>-C
</code> option has the same effect.
1306 <dt class=
"hdlist1">
1309 <dt class=
"hdlist1">
1310 --irreversible-delete
1314 Omit the preimage for deletes, i.e. print only the header but not
1315 the diff between the preimage and
<code>/dev/null
</code>. The resulting patch
1316 is not meant to be applied with
<code>patch
</code> or
<code>git apply
</code>; this is
1317 solely for people who want to just concentrate on reviewing the
1318 text after the change. In addition, the output obviously lacks
1319 enough information to apply such a patch in reverse, even manually,
1320 hence the name of the option.
1322 <div class=
"paragraph"><p>When used together with
<code>-B
</code>, omit also the preimage in the deletion part
1323 of a delete/create pair.
</p></div>
1325 <dt class=
"hdlist1">
1330 The
<code>-M
</code> and
<code>-C
</code> options involve some preliminary steps that
1331 can detect subsets of renames/copies cheaply, followed by an
1332 exhaustive fallback portion that compares all remaining
1333 unpaired destinations to all relevant sources. (For renames,
1334 only remaining unpaired sources are relevant; for copies, all
1335 original sources are relevant.) For N sources and
1336 destinations, this exhaustive check is O(N^
2). This option
1337 prevents the exhaustive portion of rename/copy detection from
1338 running if the number of source/destination files involved
1339 exceeds the specified number. Defaults to diff.renameLimit.
1340 Note that a value of
0 is treated as unlimited.
1343 <dt class=
"hdlist1">
1348 Control the order in which files appear in the output.
1349 This overrides the
<code>diff.orderFile
</code> configuration variable
1350 (see
<a href=
"git-config.html">git-config(
1)
</a>). To cancel
<code>diff.orderFile
</code>,
1351 use
<code>-O/dev/null
</code>.
1353 <div class=
"paragraph"><p>The output order is determined by the order of glob patterns in
1355 All files with pathnames that match the first pattern are output
1356 first, all files with pathnames that match the second pattern (but not
1357 the first) are output next, and so on.
1358 All files with pathnames that do not match any pattern are output
1359 last, as if there was an implicit match-all pattern at the end of the
1361 If multiple pathnames have the same rank (they match the same pattern
1362 but no earlier patterns), their output order relative to each other is
1363 the normal order.
</p></div>
1364 <div class=
"paragraph"><p><orderfile
> is parsed as follows:
</p></div>
1365 <div class=
"openblock">
1366 <div class=
"content">
1367 <div class=
"ulist"><ul>
1370 Blank lines are ignored, so they can be used as separators for
1376 Lines starting with a hash (
"<code>#</code>") are ignored, so they can be used
1377 for comments. Add a backslash (
"<code>\</code>") to the beginning of the
1378 pattern if it starts with a hash.
1383 Each other line contains a single pattern.
1388 <div class=
"paragraph"><p>Patterns have the same syntax and semantics as patterns used for
1389 fnmatch(
3) without the FNM_PATHNAME flag, except a pathname also
1390 matches a pattern if removing any number of the final pathname
1391 components matches the pattern. For example, the pattern
"<code>foo*bar</code>"
1392 matches
"<code>fooasdfbar</code>" and
"<code>foo/bar/baz/asdf</code>" but not
"<code>foobarx</code>".
</p></div>
1394 <dt class=
"hdlist1">
1395 --skip-to=
<file
>
1397 <dt class=
"hdlist1">
1398 --rotate-to=
<file
>
1402 Discard the files before the named
<file
> from the output
1403 (i.e.
<em>skip to
</em>), or move them to the end of the output
1404 (i.e.
<em>rotate to
</em>). These options were invented primarily for the use
1405 of the
<code>git difftool
</code> command, and may not be very useful
1409 <dt class=
"hdlist1">
1410 --relative[=
<path
>]
1412 <dt class=
"hdlist1">
1417 When run from a subdirectory of the project, it can be
1418 told to exclude changes outside the directory and show
1419 pathnames relative to it with this option. When you are
1420 not in a subdirectory (e.g. in a bare repository), you
1421 can name which subdirectory to make the output relative
1422 to by giving a
<path
> as an argument.
1423 <code>--no-relative
</code> can be used to countermand both
<code>diff.relative
</code> config
1424 option and previous
<code>--relative
</code>.
1427 <dt class=
"hdlist1">
1430 <dt class=
"hdlist1">
1435 Treat all files as text.
1438 <dt class=
"hdlist1">
1443 Ignore carriage-return at the end of line when doing a comparison.
1446 <dt class=
"hdlist1">
1447 --ignore-space-at-eol
1451 Ignore changes in whitespace at EOL.
1454 <dt class=
"hdlist1">
1457 <dt class=
"hdlist1">
1458 --ignore-space-change
1462 Ignore changes in amount of whitespace. This ignores whitespace
1463 at line end, and considers all other sequences of one or
1464 more whitespace characters to be equivalent.
1467 <dt class=
"hdlist1">
1470 <dt class=
"hdlist1">
1475 Ignore whitespace when comparing lines. This ignores
1476 differences even if one line has whitespace where the other
1480 <dt class=
"hdlist1">
1481 --ignore-blank-lines
1485 Ignore changes whose lines are all blank.
1488 <dt class=
"hdlist1">
1491 <dt class=
"hdlist1">
1492 --ignore-matching-lines=
<regex
>
1496 Ignore changes whose all lines match
<regex
>. This option may
1497 be specified more than once.
1500 <dt class=
"hdlist1">
1501 --inter-hunk-context=
<lines
>
1505 Show the context between diff hunks, up to the specified number
1506 of lines, thereby fusing hunks that are close to each other.
1507 Defaults to
<code>diff.interHunkContext
</code> or
0 if the config option
1511 <dt class=
"hdlist1">
1514 <dt class=
"hdlist1">
1519 Show whole function as context lines for each change.
1520 The function names are determined in the same way as
1521 <code>git diff
</code> works out patch hunk headers (see
<em>Defining a
1522 custom hunk-header
</em> in
<a href=
"gitattributes.html">gitattributes(
5)
</a>).
1525 <dt class=
"hdlist1">
1530 Allow an external diff helper to be executed. If you set an
1531 external diff driver with
<a href=
"gitattributes.html">gitattributes(
5)
</a>, you need
1532 to use this option with
<a href=
"git-log.html">git-log(
1)
</a> and friends.
1535 <dt class=
"hdlist1">
1540 Disallow external diff drivers.
1543 <dt class=
"hdlist1">
1546 <dt class=
"hdlist1">
1551 Allow (or disallow) external text conversion filters to be run
1552 when comparing binary files. See
<a href=
"gitattributes.html">gitattributes(
5)
</a> for
1553 details. Because textconv filters are typically a one-way
1554 conversion, the resulting diff is suitable for human
1555 consumption, but cannot be applied. For this reason, textconv
1556 filters are enabled by default only for
<a href=
"git-diff.html">git-diff(
1)
</a> and
1557 <a href=
"git-log.html">git-log(
1)
</a>, but not for
<a href=
"git-format-patch.html">git-format-patch(
1)
</a> or
1558 diff plumbing commands.
1561 <dt class=
"hdlist1">
1562 --ignore-submodules[=
<when
>]
1566 Ignore changes to submodules in the diff generation.
<when
> can be
1567 either
"none",
"untracked",
"dirty" or
"all", which is the default.
1568 Using
"none" will consider the submodule modified when it either contains
1569 untracked or modified files or its HEAD differs from the commit recorded
1570 in the superproject and can be used to override any settings of the
1571 <em>ignore
</em> option in
<a href=
"git-config.html">git-config(
1)
</a> or
<a href=
"gitmodules.html">gitmodules(
5)
</a>. When
1572 "untracked" is used submodules are not considered dirty when they only
1573 contain untracked content (but they are still scanned for modified
1574 content). Using
"dirty" ignores all changes to the work tree of submodules,
1575 only changes to the commits stored in the superproject are shown (this was
1576 the behavior until
1.7.0). Using
"all" hides all changes to submodules.
1579 <dt class=
"hdlist1">
1580 --src-prefix=
<prefix
>
1584 Show the given source prefix instead of
"a/".
1587 <dt class=
"hdlist1">
1588 --dst-prefix=
<prefix
>
1592 Show the given destination prefix instead of
"b/".
1595 <dt class=
"hdlist1">
1600 Do not show any source or destination prefix.
1603 <dt class=
"hdlist1">
1608 Use the default source and destination prefixes (
"a/" and
"b/").
1609 This overrides configuration variables such as
<code>diff.noprefix
</code>,
1610 <code>diff.srcPrefix
</code>,
<code>diff.dstPrefix
</code>, and
<code>diff.mnemonicPrefix
</code>
1611 (see
<code>git-config
</code>(
1)).
1614 <dt class=
"hdlist1">
1615 --line-prefix=
<prefix
>
1619 Prepend an additional prefix to every line of output.
1622 <dt class=
"hdlist1">
1623 --ita-invisible-in-index
1627 By default entries added by
"git add -N" appear as an existing
1628 empty file in
"git diff" and a new file in
"git diff --cached".
1629 This option makes the entry appear as a new file in
"git diff"
1630 and non-existent in
"git diff --cached". This option could be
1631 reverted with
<code>--ita-visible-in-index
</code>. Both options are
1632 experimental and could be removed in future.
1636 <div class=
"paragraph"><p>For more detailed explanation on these common options, see also
1637 <a href=
"gitdiffcore.html">gitdiffcore(
7)
</a>.
</p></div>
1638 <div class=
"dlist"><dl>
1639 <dt class=
"hdlist1">
1644 Prepare patches from the topmost
<n
> commits.
1647 <dt class=
"hdlist1">
1650 <dt class=
"hdlist1">
1651 --output-directory
<dir
>
1655 Use
<dir
> to store the resulting files, instead of the
1656 current working directory.
1659 <dt class=
"hdlist1">
1662 <dt class=
"hdlist1">
1667 Name output in
<em>[PATCH n/m]
</em> format, even with a single patch.
1670 <dt class=
"hdlist1">
1673 <dt class=
"hdlist1">
1678 Name output in
<em>[PATCH]
</em> format.
1681 <dt class=
"hdlist1">
1682 --start-number
<n
>
1686 Start numbering the patches at
<n
> instead of
1.
1689 <dt class=
"hdlist1">
1694 Output file names will be a simple number sequence
1695 without the default first line of the commit appended.
1698 <dt class=
"hdlist1">
1701 <dt class=
"hdlist1">
1706 Do not strip/add
<em>[PATCH]
</em> from the first line of the
1710 <dt class=
"hdlist1">
1713 <dt class=
"hdlist1">
1718 Add a
<code>Signed-off-by
</code> trailer to the commit message, using
1719 the committer identity of yourself.
1720 See the signoff option in
<a href=
"git-commit.html">git-commit(
1)
</a> for more information.
1723 <dt class=
"hdlist1">
1728 Print all commits to the standard output in mbox format,
1729 instead of creating a file for each one.
1732 <dt class=
"hdlist1">
1733 --attach[=
<boundary
>]
1737 Create multipart/mixed attachment, the first part of
1738 which is the commit message and the patch itself in the
1739 second part, with
<code>Content-Disposition: attachment
</code>.
1742 <dt class=
"hdlist1">
1747 Disable the creation of an attachment, overriding the
1748 configuration setting.
1751 <dt class=
"hdlist1">
1752 --inline[=
<boundary
>]
1756 Create multipart/mixed attachment, the first part of
1757 which is the commit message and the patch itself in the
1758 second part, with
<code>Content-Disposition: inline
</code>.
1761 <dt class=
"hdlist1">
1762 --thread[=
<style
>]
1764 <dt class=
"hdlist1">
1769 Controls addition of
<code>In-Reply-To
</code> and
<code>References
</code> headers to
1770 make the second and subsequent mails appear as replies to the
1771 first. Also controls generation of the
<code>Message-ID
</code> header to
1774 <div class=
"paragraph"><p>The optional
<style
> argument can be either
<code>shallow
</code> or
<code>deep
</code>.
1775 <em>shallow
</em> threading makes every mail a reply to the head of the
1776 series, where the head is chosen from the cover letter, the
1777 <code>--in-reply-to
</code>, and the first patch mail, in this order.
<em>deep
</em>
1778 threading makes every mail a reply to the previous one.
</p></div>
1779 <div class=
"paragraph"><p>The default is
<code>--no-thread
</code>, unless the
<code>format.thread
</code> configuration
1780 is set.
<code>--thread
</code> without an argument is equivalent to
<code>--thread=shallow
</code>.
</p></div>
1781 <div class=
"paragraph"><p>Beware that the default for
<em>git send-email
</em> is to thread emails
1782 itself. If you want
<code>git format-patch
</code> to take care of threading, you
1783 will want to ensure that threading is disabled for
<code>git send-email
</code>.
</p></div>
1785 <dt class=
"hdlist1">
1786 --in-reply-to=
<message-id
>
1790 Make the first mail (or all the mails with
<code>--no-thread
</code>) appear as a
1791 reply to the given
<message-id
>, which avoids breaking threads to
1792 provide a new patch series.
1795 <dt class=
"hdlist1">
1796 --ignore-if-in-upstream
1800 Do not include a patch that matches a commit in
1801 <until
>..
<since
>. This will examine all patches reachable
1802 from
<since
> but not from
<until
> and compare them with the
1803 patches being generated, and any patch that matches is
1807 <dt class=
"hdlist1">
1812 Include patches for commits that do not introduce any change,
1813 which are omitted by default.
1816 <dt class=
"hdlist1">
1817 --cover-from-description=
<mode
>
1821 Controls which parts of the cover letter will be automatically
1822 populated using the branch
’s description.
1824 <div class=
"paragraph"><p>If
<code><mode
></code> is
<code>message
</code> or
<code>default
</code>, the cover letter subject will be
1825 populated with placeholder text. The body of the cover letter will be
1826 populated with the branch
’s description. This is the default mode when
1827 no configuration nor command line option is specified.
</p></div>
1828 <div class=
"paragraph"><p>If
<code><mode
></code> is
<code>subject
</code>, the first paragraph of the branch description will
1829 populate the cover letter subject. The remainder of the description will
1830 populate the body of the cover letter.
</p></div>
1831 <div class=
"paragraph"><p>If
<code><mode
></code> is
<code>auto
</code>, if the first paragraph of the branch description
1832 is greater than
100 bytes, then the mode will be
<code>message
</code>, otherwise
1833 <code>subject
</code> will be used.
</p></div>
1834 <div class=
"paragraph"><p>If
<code><mode
></code> is
<code>none
</code>, both the cover letter subject and body will be
1835 populated with placeholder text.
</p></div>
1837 <dt class=
"hdlist1">
1838 --description-file=
<file
>
1842 Use the contents of
<file
> instead of the branch
’s description
1843 for generating the cover letter.
1846 <dt class=
"hdlist1">
1847 --subject-prefix=
<subject-prefix
>
1851 Instead of the standard
<em>[PATCH]
</em> prefix in the subject
1852 line, instead use
<em>[
<subject-prefix
>]
</em>. This can be used
1853 to name a patch series, and can be combined with the
1854 <code>--numbered
</code> option.
1856 <div class=
"paragraph"><p>The configuration variable
<code>format.subjectPrefix
</code> may also be used
1857 to configure a subject prefix to apply to a given repository for
1858 all patches. This is often useful on mailing lists which receive
1859 patches for several repositories and can be used to disambiguate
1860 the patches (with a value of e.g.
"PATCH my-project").
</p></div>
1862 <dt class=
"hdlist1">
1863 --filename-max-length=
<n
>
1867 Instead of the standard
64 bytes, chomp the generated output
1868 filenames at around
<em><n
></em> bytes (too short a value will be
1869 silently raised to a reasonable length). Defaults to the
1870 value of the
<code>format.filenameMaxLength
</code> configuration
1871 variable, or
64 if unconfigured.
1874 <dt class=
"hdlist1">
1879 Prepends
"RFC" to the subject prefix (producing
"RFC PATCH" by
1880 default). RFC means
"Request For Comments"; use this when sending
1881 an experimental patch for discussion rather than application.
1884 <dt class=
"hdlist1">
1887 <dt class=
"hdlist1">
1888 --reroll-count=
<n
>
1892 Mark the series as the
<n
>-th iteration of the topic. The
1893 output filenames have
<code>v
<n
></code> prepended to them, and the
1894 subject prefix (
"PATCH" by default, but configurable via the
1895 <code>--subject-prefix
</code> option) has ` v
<n
>` appended to it. E.g.
1896 <code>--reroll-count=
4</code> may produce
<code>v4-
0001-add-makefile.patch
</code>
1897 file that has
"Subject: [PATCH v4 1/20] Add makefile" in it.
1898 <code><n
></code> does not have to be an integer (e.g.
"--reroll-count=4.4",
1899 or
"--reroll-count=4rev2" are allowed), but the downside of
1900 using such a reroll-count is that the range-diff/interdiff
1901 with the previous version does not state exactly which
1902 version the new iteration is compared against.
1905 <dt class=
"hdlist1">
1910 Add a
<code>To:
</code> header to the email headers. This is in addition
1911 to any configured headers, and may be used multiple times.
1912 The negated form
<code>--no-to
</code> discards all
<code>To:
</code> headers added so
1913 far (from config or command line).
1916 <dt class=
"hdlist1">
1921 Add a
<code>Cc:
</code> header to the email headers. This is in addition
1922 to any configured headers, and may be used multiple times.
1923 The negated form
<code>--no-cc
</code> discards all
<code>Cc:
</code> headers added so
1924 far (from config or command line).
1927 <dt class=
"hdlist1">
1930 <dt class=
"hdlist1">
1931 --from=
<ident
>
1935 Use
<code>ident
</code> in the
<code>From:
</code> header of each commit email. If the
1936 author ident of the commit is not textually identical to the
1937 provided
<code>ident
</code>, place a
<code>From:
</code> header in the body of the
1938 message with the original author. If no
<code>ident
</code> is given, use
1939 the committer ident.
1941 <div class=
"paragraph"><p>Note that this option is only useful if you are actually sending the
1942 emails and want to identify yourself as the sender, but retain the
1943 original author (and
<code>git am
</code> will correctly pick up the in-body
1944 header). Note also that
<code>git send-email
</code> already handles this
1945 transformation for you, and this option should not be used if you are
1946 feeding the result to
<code>git send-email
</code>.
</p></div>
1948 <dt class=
"hdlist1">
1949 --[no-]force-in-body-from
1953 With the e-mail sender specified via the
<code>--from
</code> option, by
1954 default, an in-body
"From:" to identify the real author of
1955 the commit is added at the top of the commit log message if
1956 the sender is different from the author. With this option,
1957 the in-body
"From:" is added even when the sender and the
1958 author have the same name and address, which may help if the
1959 mailing list software mangles the sender
’s identity.
1960 Defaults to the value of the
<code>format.forceInBodyFrom
</code>
1961 configuration variable.
1964 <dt class=
"hdlist1">
1965 --add-header=
<header
>
1969 Add an arbitrary header to the email headers. This is in addition
1970 to any configured headers, and may be used multiple times.
1971 For example,
<code>--add-header=
"Organization: git-foo"</code>.
1972 The negated form
<code>--no-add-header
</code> discards
<strong>all
</strong> (
<code>To:
</code>,
1973 <code>Cc:
</code>, and custom) headers added so far from config or command
1977 <dt class=
"hdlist1">
1982 In addition to the patches, generate a cover letter file
1983 containing the branch description, shortlog and the overall diffstat. You can
1984 fill in a description in the file before sending it out.
1987 <dt class=
"hdlist1">
1988 --encode-email-headers
1990 <dt class=
"hdlist1">
1991 --no-encode-email-headers
1995 Encode email headers that have non-ASCII characters with
1996 "Q-encoding" (described in RFC
2047), instead of outputting the
1997 headers verbatim. Defaults to the value of the
1998 <code>format.encodeEmailHeaders
</code> configuration variable.
2001 <dt class=
"hdlist1">
2002 --interdiff=
<previous
>
2006 As a reviewer aid, insert an interdiff into the cover letter,
2007 or as commentary of the lone patch of a
1-patch series, showing
2008 the differences between the previous version of the patch series and
2009 the series currently being formatted.
<code>previous
</code> is a single revision
2010 naming the tip of the previous series which shares a common base with
2011 the series being formatted (for example
<code>git format-patch
2012 --cover-letter --interdiff=feature/v1 -
3 feature/v2
</code>).
2015 <dt class=
"hdlist1">
2016 --range-diff=
<previous
>
2020 As a reviewer aid, insert a range-diff (see
<a href=
"git-range-diff.html">git-range-diff(
1)
</a>)
2021 into the cover letter, or as commentary of the lone patch of a
2022 1-patch series, showing the differences between the previous
2023 version of the patch series and the series currently being formatted.
2024 <code>previous
</code> can be a single revision naming the tip of the previous
2025 series if it shares a common base with the series being formatted (for
2026 example
<code>git format-patch --cover-letter --range-diff=feature/v1 -
3
2027 feature/v2
</code>), or a revision range if the two versions of the series are
2028 disjoint (for example
<code>git format-patch --cover-letter
2029 --range-diff=feature/v1~
3..feature/v1 -
3 feature/v2
</code>).
2031 <div class=
"paragraph"><p>Note that diff options passed to the command affect how the primary
2032 product of
<code>format-patch
</code> is generated, and they are not passed to
2033 the underlying
<code>range-diff
</code> machinery used to generate the cover-letter
2034 material (this may change in the future).
</p></div>
2036 <dt class=
"hdlist1">
2037 --creation-factor=
<percent
>
2041 Used with
<code>--range-diff
</code>, tweak the heuristic which matches up commits
2042 between the previous and current series of patches by adjusting the
2043 creation/deletion cost fudge factor. See
<a href=
"git-range-diff.html">git-range-diff(
1)
</a>)
2047 <dt class=
"hdlist1">
2048 --notes[=
<ref
>]
2050 <dt class=
"hdlist1">
2055 Append the notes (see
<a href=
"git-notes.html">git-notes(
1)
</a>) for the commit
2056 after the three-dash line.
2058 <div class=
"paragraph"><p>The expected use case of this is to write supporting explanation for
2059 the commit that does not belong to the commit log message proper,
2060 and include it with the patch submission. While one can simply write
2061 these explanations after
<code>format-patch
</code> has run but before sending,
2062 keeping them as Git notes allows them to be maintained between versions
2063 of the patch series (but see the discussion of the
<code>notes.rewrite
</code>
2064 configuration options in
<a href=
"git-notes.html">git-notes(
1)
</a> to use this workflow).
</p></div>
2065 <div class=
"paragraph"><p>The default is
<code>--no-notes
</code>, unless the
<code>format.notes
</code> configuration is
2068 <dt class=
"hdlist1">
2069 --[no-]signature=
<signature
>
2073 Add a signature to each message produced. Per RFC
3676 the signature
2074 is separated from the body by a line with '-- ' on it. If the
2075 signature option is omitted the signature defaults to the Git version
2079 <dt class=
"hdlist1">
2080 --signature-file=
<file
>
2084 Works just like --signature except the signature is read from a file.
2087 <dt class=
"hdlist1">
2088 --suffix=.
<sfx
>
2092 Instead of using
<code>.patch
</code> as the suffix for generated
2093 filenames, use specified suffix. A common alternative is
2094 <code>--suffix=.txt
</code>. Leaving this empty will remove the
<code>.patch
</code>
2097 <div class=
"paragraph"><p>Note that the leading character does not have to be a dot; for example,
2098 you can use
<code>--suffix=-patch
</code> to get
<code>0001-description-of-my-change-patch
</code>.
</p></div>
2100 <dt class=
"hdlist1">
2103 <dt class=
"hdlist1">
2108 Do not print the names of the generated files to standard output.
2111 <dt class=
"hdlist1">
2116 Do not output contents of changes in binary files, instead
2117 display a notice that those files changed. Patches generated
2118 using this option cannot be applied properly, but they are
2119 still useful for code review.
2122 <dt class=
"hdlist1">
2127 Output an all-zero hash in each patch
’s From header instead
2128 of the hash of the commit.
2131 <dt class=
"hdlist1">
2132 --[no-]base[=
<commit
>]
2136 Record the base tree information to identify the state the
2137 patch series applies to. See the BASE TREE INFORMATION section
2138 below for details. If
<commit
> is
"auto", a base commit is
2139 automatically chosen. The
<code>--no-base
</code> option overrides a
2140 <code>format.useAutoBase
</code> configuration.
2143 <dt class=
"hdlist1">
2148 Treat the revision argument as a
<revision-range
>, even if it
2149 is just a single commit (that would normally be treated as a
2150 <since
>). Note that root commits included in the specified
2151 range are always formatted as creation patches, independently
2155 <dt class=
"hdlist1">
2160 Show progress reports on stderr as patches are generated.
2167 <h2 id=
"_configuration">CONFIGURATION
</h2>
2168 <div class=
"sectionbody">
2169 <div class=
"paragraph"><p>You can specify extra mail header lines to be added to each message,
2170 defaults for the subject prefix and file suffix, number patches when
2171 outputting more than one patch, add
"To:" or
"Cc:" headers, configure
2172 attachments, change the patch output directory, and sign off patches
2173 with configuration variables.
</p></div>
2174 <div class=
"listingblock">
2175 <div class=
"content">
2177 headers =
"Organization: git-foo\n"
2178 subjectPrefix = CHANGE
2183 attach [ = mime-boundary-string ]
2185 outputDirectory =
<directory
>
2187 coverFromDescription = auto
</code></pre>
2192 <h2 id=
"_discussion">DISCUSSION
</h2>
2193 <div class=
"sectionbody">
2194 <div class=
"paragraph"><p>The patch produced by
<em>git format-patch
</em> is in UNIX mailbox format,
2195 with a fixed
"magic" time stamp to indicate that the file is output
2196 from format-patch rather than a real mailbox, like so:
</p></div>
2197 <div class=
"listingblock">
2198 <div class=
"content">
2199 <pre><code>From
8f72bad1baf19a53459661343e21d6491c3908d3 Mon Sep
17 00:
00:
00 2001
2200 From: Tony Luck
<tony.luck@intel.com
>
2201 Date: Tue,
13 Jul
2010 11:
42:
54 -
0700
2202 Subject: [PATCH] =?UTF-
8?q?[IA64]=
20Put=
20ia64=
20config=
20files=
20on=
20the=
20?=
2203 =?UTF-
8?q?Uwe=
20Kleine-K=C3=B6nig=
20diet?=
2205 Content-Type: text/plain; charset=UTF-
8
2206 Content-Transfer-Encoding:
8bit
2208 arch/arm config files were slimmed down using a python script
2209 (See commit c2330e286f68f1c408b4aa6515ba49d57f05beae comment)
2211 Do the same for ia64 so we can have sleek
& trim looking
2214 <div class=
"paragraph"><p>Typically it will be placed in a MUA
’s drafts folder, edited to add
2215 timely commentary that should not go in the changelog after the three
2216 dashes, and then sent as a message whose body, in our example, starts
2217 with
"arch/arm config files were…". On the receiving end, readers
2218 can save interesting patches in a UNIX mailbox and apply them with
2219 <a href=
"git-am.html">git-am(
1)
</a>.
</p></div>
2220 <div class=
"paragraph"><p>When a patch is part of an ongoing discussion, the patch generated by
2221 <em>git format-patch
</em> can be tweaked to take advantage of the
<em>git am
2222 --scissors
</em> feature. After your response to the discussion comes a
2223 line that consists solely of
"<code>-- >8 --</code>" (scissors and perforation),
2224 followed by the patch with unnecessary header fields removed:
</p></div>
2225 <div class=
"listingblock">
2226 <div class=
"content">
2228 > So we should do such-and-such.
2230 Makes sense to me. How about this patch?
2233 Subject: [IA64] Put ia64 config files on the Uwe Kleine-König diet
2235 arch/arm config files were slimmed down using a python script
2238 <div class=
"paragraph"><p>When sending a patch this way, most often you are sending your own
2239 patch, so in addition to the
"<code>From $SHA1 $magic_timestamp</code>" marker you
2240 should omit
<code>From:
</code> and
<code>Date:
</code> lines from the patch file. The patch
2241 title is likely to be different from the subject of the discussion the
2242 patch is in response to, so it is likely that you would want to keep
2243 the Subject: line, like the example above.
</p></div>
2245 <h3 id=
"_checking_for_patch_corruption">Checking for patch corruption
</h3>
2246 <div class=
"paragraph"><p>Many mailers if not set up properly will corrupt whitespace. Here are
2247 two common types of corruption:
</p></div>
2248 <div class=
"ulist"><ul>
2251 Empty context lines that do not have
<em>any
</em> whitespace.
2256 Non-empty context lines that have one extra whitespace at the
2261 <div class=
"paragraph"><p>One way to test if your MUA is set up correctly is:
</p></div>
2262 <div class=
"ulist"><ul>
2265 Send the patch to yourself, exactly the way you would, except
2266 with To: and Cc: lines that do not contain the list and
2272 Save that patch to a file in UNIX mailbox format. Call it a.patch,
2280 <div class=
"literalblock">
2281 <div class=
"content">
2282 <pre><code>$ git fetch
<project
> master:test-apply
2283 $ git switch test-apply
2284 $ git restore --source=HEAD --staged --worktree :/
2285 $ git am a.patch
</code></pre>
2289 <div class=
"paragraph"><p>If it does not apply correctly, there can be various reasons.
</p></div>
2290 <div class=
"ulist"><ul>
2293 The patch itself does not apply cleanly. That is
<em>bad
</em> but
2294 does not have much to do with your MUA. You might want to rebase
2295 the patch with
<a href=
"git-rebase.html">git-rebase(
1)
</a> before regenerating it in
2301 The MUA corrupted your patch;
"am" would complain that
2302 the patch does not apply. Look in the .git/rebase-apply/ subdirectory and
2303 see what
<em>patch
</em> file contains and check for the common
2304 corruption patterns mentioned above.
2309 While at it, check the
<em>info
</em> and
<em>final-commit
</em> files as well.
2310 If what is in
<em>final-commit
</em> is not exactly what you would want to
2311 see in the commit log message, it is very likely that the
2312 receiver would end up hand editing the log message when applying
2313 your patch. Things like
"Hi, this is my first patch.\n" in the
2314 patch e-mail should come after the three-dash line that signals
2315 the end of the commit message.
2323 <h2 id=
"_mua_specific_hints">MUA-SPECIFIC HINTS
</h2>
2324 <div class=
"sectionbody">
2325 <div class=
"paragraph"><p>Here are some hints on how to successfully submit patches inline using
2326 various mailers.
</p></div>
2328 <h3 id=
"_gmail">GMail
</h3>
2329 <div class=
"paragraph"><p>GMail does not have any way to turn off line wrapping in the web
2330 interface, so it will mangle any emails that you send. You can however
2331 use
"git send-email" and send your patches through the GMail SMTP server, or
2332 use any IMAP email client to connect to the google IMAP server and forward
2333 the emails through that.
</p></div>
2334 <div class=
"paragraph"><p>For hints on using
<em>git send-email
</em> to send your patches through the
2335 GMail SMTP server, see the EXAMPLE section of
<a href=
"git-send-email.html">git-send-email(
1)
</a>.
</p></div>
2336 <div class=
"paragraph"><p>For hints on submission using the IMAP interface, see the EXAMPLE
2337 section of
<a href=
"git-imap-send.html">git-imap-send(
1)
</a>.
</p></div>
2340 <h3 id=
"_thunderbird">Thunderbird
</h3>
2341 <div class=
"paragraph"><p>By default, Thunderbird will both wrap emails as well as flag
2342 them as being
<em>format=flowed
</em>, both of which will make the
2343 resulting email unusable by Git.
</p></div>
2344 <div class=
"paragraph"><p>There are three different approaches: use an add-on to turn off line wraps,
2345 configure Thunderbird to not mangle patches, or use
2346 an external editor to keep Thunderbird from mangling the patches.
</p></div>
2348 <h4 id=
"_approach_1_add_on">Approach #
1 (add-on)
</h4>
2349 <div class=
"paragraph"><p>Install the Toggle Word Wrap add-on that is available from
2350 <a href=
"https://addons.mozilla.org/thunderbird/addon/toggle-word-wrap/">https://addons.mozilla.org/thunderbird/addon/toggle-word-wrap/
</a>
2351 It adds a menu entry
"Enable Word Wrap" in the composer
’s
"Options" menu
2352 that you can tick off. Now you can compose the message as you otherwise do
2353 (cut + paste,
<em>git format-patch
</em> |
<em>git imap-send
</em>, etc), but you have to
2354 insert line breaks manually in any text that you type.
</p></div>
2357 <h4 id=
"_approach_2_configuration">Approach #
2 (configuration)
</h4>
2358 <div class=
"paragraph"><p>Three steps:
</p></div>
2359 <div class=
"olist arabic"><ol class=
"arabic">
2362 Configure your mail server composition as plain text:
2363 Edit
…Account Settings
…Composition
& Addressing,
2364 uncheck
"Compose Messages in HTML".
2369 Configure your general composition window to not wrap.
2371 <div class=
"paragraph"><p>In Thunderbird
2:
2372 Edit..Preferences..Composition, wrap plain text messages at
0</p></div>
2373 <div class=
"paragraph"><p>In Thunderbird
3:
2374 Edit..Preferences..Advanced..Config Editor. Search for
2375 "mail.wrap_long_lines".
2376 Toggle it to make sure it is set to
<code>false
</code>. Also, search for
2377 "mailnews.wraplength" and set the value to
0.
</p></div>
2381 Disable the use of format=flowed:
2382 Edit..Preferences..Advanced..Config Editor. Search for
2383 "mailnews.send_plaintext_flowed".
2384 Toggle it to make sure it is set to
<code>false
</code>.
2388 <div class=
"paragraph"><p>After that is done, you should be able to compose email as you
2389 otherwise would (cut + paste,
<em>git format-patch
</em> |
<em>git imap-send
</em>, etc),
2390 and the patches will not be mangled.
</p></div>
2393 <h4 id=
"_approach_3_external_editor">Approach #
3 (external editor)
</h4>
2394 <div class=
"paragraph"><p>The following Thunderbird extensions are needed:
2395 AboutConfig from
<a href=
"https://mjg.github.io/AboutConfig/">https://mjg.github.io/AboutConfig/
</a> and
2396 External Editor from
<a href=
"https://globs.org/articles.php?lng=en&pg=8">https://globs.org/articles.php?lng=en
&pg=
8</a></p></div>
2397 <div class=
"olist arabic"><ol class=
"arabic">
2400 Prepare the patch as a text file using your method of choice.
2405 Before opening a compose window, use Edit
→Account Settings to
2406 uncheck the
"Compose messages in HTML format" setting in the
2407 "Composition & Addressing" panel of the account to be used to
2413 In the main Thunderbird window,
<em>before
</em> you open the compose
2414 window for the patch, use Tools
→about:config to set the
2415 following to the indicated values:
2417 <div class=
"listingblock">
2418 <div class=
"content">
2419 <pre><code> mailnews.send_plaintext_flowed =
> false
2420 mailnews.wraplength =
> 0</code></pre>
2425 Open a compose window and click the external editor icon.
2430 In the external editor window, read in the patch file and exit
2431 the editor normally.
2435 <div class=
"paragraph"><p>Side note: it may be possible to do step
2 with
2436 about:config and the following settings but no one
’s tried yet.
</p></div>
2437 <div class=
"listingblock">
2438 <div class=
"content">
2439 <pre><code> mail.html_compose =
> false
2440 mail.identity.default.compose_html =
> false
2441 mail.identity.id?.compose_html =
> false
</code></pre>
2443 <div class=
"paragraph"><p>There is a script in contrib/thunderbird-patch-inline which can help
2444 you include patches with Thunderbird in an easy way. To use it, do the
2445 steps above and then use the script as the external editor.
</p></div>
2449 <h3 id=
"_kmail">KMail
</h3>
2450 <div class=
"paragraph"><p>This should help you to submit patches inline using KMail.
</p></div>
2451 <div class=
"olist arabic"><ol class=
"arabic">
2454 Prepare the patch as a text file.
2464 Go under
"Options" in the Composer window and be sure that
2465 "Word wrap" is not set.
2470 Use Message
→ Insert file
… and insert the patch.
2475 Back in the compose window: add whatever other text you wish to the
2476 message, complete the addressing and subject fields, and press send.
2484 <h2 id=
"_base_tree_information">BASE TREE INFORMATION
</h2>
2485 <div class=
"sectionbody">
2486 <div class=
"paragraph"><p>The base tree information block is used for maintainers or third party
2487 testers to know the exact state the patch series applies to. It consists
2488 of the
<em>base commit
</em>, which is a well-known commit that is part of the
2489 stable part of the project history everybody else works off of, and zero
2490 or more
<em>prerequisite patches
</em>, which are well-known patches in flight
2491 that is not yet part of the
<em>base commit
</em> that need to be applied on top
2492 of
<em>base commit
</em> in topological order before the patches can be applied.
</p></div>
2493 <div class=
"paragraph"><p>The
<em>base commit
</em> is shown as
"base-commit: " followed by the
40-hex of
2494 the commit object name. A
<em>prerequisite patch
</em> is shown as
2495 "prerequisite-patch-id: " followed by the
40-hex
<em>patch id
</em>, which can
2496 be obtained by passing the patch through the
<code>git patch-id --stable
</code>
2498 <div class=
"paragraph"><p>Imagine that on top of the public commit P, you applied well-known
2499 patches X, Y and Z from somebody else, and then built your three-patch
2500 series A, B, C, the history would be like:
</p></div>
2501 <div class=
"literalblock">
2502 <div class=
"content">
2503 <pre><code>---P---X---Y---Z---A---B---C
</code></pre>
2505 <div class=
"paragraph"><p>With
<code>git format-patch --base=P -
3 C
</code> (or variants thereof, e.g. with
2506 <code>--cover-letter
</code> or using
<code>Z..C
</code> instead of
<code>-
3 C
</code> to specify the
2507 range), the base tree information block is shown at the end of the
2508 first message the command outputs (either the first patch, or the
2509 cover letter), like this:
</p></div>
2510 <div class=
"listingblock">
2511 <div class=
"content">
2512 <pre><code>base-commit: P
2513 prerequisite-patch-id: X
2514 prerequisite-patch-id: Y
2515 prerequisite-patch-id: Z
</code></pre>
2517 <div class=
"paragraph"><p>For non-linear topology, such as
</p></div>
2518 <div class=
"literalblock">
2519 <div class=
"content">
2520 <pre><code>---P---X---A---M---C
2522 Y---Z---B
</code></pre>
2524 <div class=
"paragraph"><p>You can also use
<code>git format-patch --base=P -
3 C
</code> to generate patches
2525 for A, B and C, and the identifiers for P, X, Y, Z are appended at the
2526 end of the first message.
</p></div>
2527 <div class=
"paragraph"><p>If set
<code>--base=auto
</code> in cmdline, it will automatically compute
2528 the base commit as the merge base of tip commit of the remote-tracking
2529 branch and revision-range specified in cmdline.
2530 For a local branch, you need to make it to track a remote branch by
<code>git branch
2531 --set-upstream-to
</code> before using this option.
</p></div>
2535 <h2 id=
"_examples">EXAMPLES
</h2>
2536 <div class=
"sectionbody">
2537 <div class=
"ulist"><ul>
2540 Extract commits between revisions R1 and R2, and apply them on top of
2541 the current branch using
<em>git am
</em> to cherry-pick them:
2543 <div class=
"listingblock">
2544 <div class=
"content">
2545 <pre><code>$ git format-patch -k --stdout R1..R2 | git am -
3 -k
</code></pre>
2550 Extract all commits which are in the current branch but not in the
2553 <div class=
"listingblock">
2554 <div class=
"content">
2555 <pre><code>$ git format-patch origin
</code></pre>
2557 <div class=
"paragraph"><p>For each commit a separate file is created in the current directory.
</p></div>
2561 Extract all commits that lead to
<em>origin
</em> since the inception of the
2564 <div class=
"listingblock">
2565 <div class=
"content">
2566 <pre><code>$ git format-patch --root origin
</code></pre>
2571 The same as the previous one:
2573 <div class=
"listingblock">
2574 <div class=
"content">
2575 <pre><code>$ git format-patch -M -B origin
</code></pre>
2577 <div class=
"paragraph"><p>Additionally, it detects and handles renames and complete rewrites
2578 intelligently to produce a renaming patch. A renaming patch reduces
2579 the amount of text output, and generally makes it easier to review.
2580 Note that non-Git
"patch" programs won
’t understand renaming patches, so
2581 use it only when you know the recipient uses Git to apply your patch.
</p></div>
2585 Extract three topmost commits from the current branch and format them
2586 as e-mailable patches:
2588 <div class=
"listingblock">
2589 <div class=
"content">
2590 <pre><code>$ git format-patch -
3</code></pre>
2597 <h2 id=
"_caveats">CAVEATS
</h2>
2598 <div class=
"sectionbody">
2599 <div class=
"paragraph"><p>Note that
<code>format-patch
</code> will omit merge commits from the output, even
2600 if they are part of the requested range. A simple
"patch" does not
2601 include enough information for the receiving end to reproduce the same
2602 merge commit.
</p></div>
2606 <h2 id=
"_see_also">SEE ALSO
</h2>
2607 <div class=
"sectionbody">
2608 <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>
2612 <h2 id=
"_git">GIT
</h2>
2613 <div class=
"sectionbody">
2614 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
2618 <div id=
"footnotes"><hr /></div>
2620 <div id=
"footer-text">
2622 2024-
02-
08 15:
45:
59 PST