]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-format-patch.txt
Documentation: stylistically normalize references to Signed-off-by:
[thirdparty/git.git] / Documentation / git-format-patch.txt
CommitLineData
215a7ad1
JH
1git-format-patch(1)
2===================
7fc9d69f
JH
3
4NAME
5----
7bd7f280 6git-format-patch - Prepare patches for e-mail submission
7fc9d69f
JH
7
8
9SYNOPSIS
10--------
353ce815 11[verse]
50710ce4 12'git format-patch' [-k] [(-o|--output-directory) <dir> | --stdout]
f693b7e9 13 [--no-thread | --thread[=<style>]]
50710ce4
SB
14 [(--attach|--inline)[=<boundary>] | --no-attach]
15 [-s | --signoff]
6622d9c7 16 [--signature=<signature> | --no-signature]
7022650f 17 [--signature-file=<file>]
a5a27c79
DB
18 [-n | --numbered | -N | --no-numbered]
19 [--start-number <n>] [--numbered-files]
c1a6f21c 20 [--in-reply-to=<message id>] [--suffix=.<sfx>]
a5a27c79 21 [--ignore-if-in-upstream]
bf8e65b3 22 [--cover-from-description=<mode>]
c1a6f21c 23 [--rfc] [--subject-prefix=<subject prefix>]
68e83a5b 24 [(--reroll-count|-v) <n>]
ae6c098f 25 [--to=<email>] [--cc=<email>]
83d9db78 26 [--[no-]cover-letter] [--quiet]
19d097e3 27 [--[no-]encode-email-headers]
83d9db78 28 [--no-notes | --notes[=<ref>]]
126facf8 29 [--interdiff=<previous>]
8631bf1c 30 [--range-diff=<previous> [--creation-factor=<percent>]]
738e88a2 31 [--progress]
50710ce4 32 [<common diff options>]
8a1d076e 33 [ <since> | <revision range> ]
7fc9d69f
JH
34
35DESCRIPTION
36-----------
2052d146 37
8a1d076e 38Prepare each commit with its patch in
2052d146 39one file per commit, formatted to resemble UNIX mailbox format.
2052d146 40The output of this command is convenient for e-mail submission or
0b444cdb 41for use with 'git am'.
35ef3a4c 42
8a1d076e
JH
43There are two ways to specify which commits to operate on.
44
451. A single commit, <since>, specifies that the commits leading
46 to the tip of the current branch that are not in the history
47 that leads to the <since> to be output.
48
492. Generic <revision range> expression (see "SPECIFYING
9d83e382 50 REVISIONS" section in linkgit:gitrevisions[7]) means the
2f6a3823
JH
51 commits in the specified range.
52
2d266f9d
TR
53The first rule takes precedence in the case of a single <commit>. To
54apply the second rule, i.e., format everything since the beginning of
9e9f132f 55history up until <commit>, use the `--root` option: `git format-patch
6cf378f0 56--root <commit>`. If you want to format only <commit> itself, you
dce5ef14 57can do this with `git format-patch -1 <commit>`.
8a1d076e 58
e6ff0f42 59By default, each output file is numbered sequentially from 1, and uses the
2052d146 60first line of the commit message (massaged for pathname safety) as
dce5ef14 61the filename. With the `--numbered-files` option, the output file names
e6ff0f42
JL
62will only be numbers, without the first line of the commit appended.
63The names of the output files are printed to standard
dce5ef14 64output, unless the `--stdout` option is specified.
66f04f38 65
dce5ef14 66If `-o` is specified, output files are created in <dir>. Otherwise
bc6bf2d7 67they are created in the current working directory. The default path
ae9f6311 68can be set with the `format.outputDirectory` configuration option.
bc6bf2d7
AK
69The `-o` option takes precedence over `format.outputDirectory`.
70To store patches in the current working directory even when
edefc318
BW
71`format.outputDirectory` points elsewhere, use `-o .`. All directory
72components will be created.
35ef3a4c 73
52ffe995
JW
74By default, the subject of a single patch is "[PATCH] " followed by
75the concatenation of lines from the commit message up to the first blank
76line (see the DISCUSSION section of linkgit:git-commit[1]).
77
78When multiple patches are output, the subject prefix will instead be
79"[PATCH n/m] ". To force 1/1 to be added for a single patch, use `-n`.
80To omit patch numbers from the subject, use `-N`.
35ef3a4c 81
dce5ef14
BG
82If given `--thread`, `git-format-patch` will generate `In-Reply-To` and
83`References` headers to make the second and subsequent patch mails appear
84as replies to the first mail; this also generates a `Message-Id` header to
cc35de84 85reference.
7fc9d69f
JH
86
87OPTIONS
88-------
c1a95fa6 89:git-format-patch: 1
b8105375
BG
90include::diff-options.txt[]
91
ed5f07a6 92-<n>::
2c642ed8 93 Prepare patches from the topmost <n> commits.
ed5f07a6 94
3240240f
SB
95-o <dir>::
96--output-directory <dir>::
35ef3a4c 97 Use <dir> to store the resulting files, instead of the
efd02016 98 current working directory.
35ef3a4c 99
3240240f
SB
100-n::
101--numbered::
a567fdcb 102 Name output in '[PATCH n/m]' format, even with a single patch.
35ef3a4c 103
3240240f
SB
104-N::
105--no-numbered::
49604a4d
BG
106 Name output in '[PATCH]' format.
107
2052d146
DS
108--start-number <n>::
109 Start numbering the patches at <n> instead of 1.
110
e6ff0f42
JL
111--numbered-files::
112 Output file names will be a simple number sequence
113 without the default first line of the commit appended.
e6ff0f42 114
3240240f
SB
115-k::
116--keep-subject::
35ef3a4c
JH
117 Do not strip/add '[PATCH]' from the first line of the
118 commit log message.
119
3240240f
SB
120-s::
121--signoff::
3abd4a67 122 Add a `Signed-off-by` trailer to the commit message, using
6f855371 123 the committer identity of yourself.
b2c150d3 124 See the signoff option in linkgit:git-commit[1] for more information.
6f855371 125
54ba6013 126--stdout::
2052d146
DS
127 Print all commits to the standard output in mbox format,
128 instead of creating a file for each one.
7fc9d69f 129
c112f689
JS
130--attach[=<boundary>]::
131 Create multipart/mixed attachment, the first part of
132 which is the commit message and the patch itself in the
dce5ef14 133 second part, with `Content-Disposition: attachment`.
c112f689 134
0db5260b
JW
135--no-attach::
136 Disable the creation of an attachment, overriding the
137 configuration setting.
138
c112f689
JS
139--inline[=<boundary>]::
140 Create multipart/mixed attachment, the first part of
141 which is the commit message and the patch itself in the
dce5ef14 142 second part, with `Content-Disposition: inline`.
a15a44ef 143
30984ed2 144--thread[=<style>]::
f693b7e9 145--no-thread::
dce5ef14 146 Controls addition of `In-Reply-To` and `References` headers to
f693b7e9 147 make the second and subsequent mails appear as replies to the
dce5ef14 148 first. Also controls generation of the `Message-Id` header to
f693b7e9 149 reference.
30984ed2
TR
150+
151The optional <style> argument can be either `shallow` or `deep`.
fd1ff306 152'shallow' threading makes every mail a reply to the head of the
30984ed2 153series, where the head is chosen from the cover letter, the
6cf378f0 154`--in-reply-to`, and the first patch mail, in this order. 'deep'
f693b7e9
YD
155threading makes every mail a reply to the previous one.
156+
ae9f6311 157The default is `--no-thread`, unless the `format.thread` configuration
dce5ef14 158is set. If `--thread` is specified without a style, it defaults to the
ae9f6311 159style specified by `format.thread` if any, or else `shallow`.
f693b7e9
YD
160+
161Beware that the default for 'git send-email' is to thread emails
dce5ef14
BG
162itself. If you want `git format-patch` to take care of threading, you
163will want to ensure that threading is disabled for `git send-email`.
28ffb898 164
c1a6f21c 165--in-reply-to=<message id>::
dce5ef14 166 Make the first mail (or all the mails with `--no-thread`) appear as a
c1a6f21c 167 reply to the given <message id>, which avoids breaking threads to
da56645d
JT
168 provide a new patch series.
169
cc75ad67
DK
170--ignore-if-in-upstream::
171 Do not include a patch that matches a commit in
172 <until>..<since>. This will examine all patches reachable
173 from <since> but not from <until> and compare them with the
174 patches being generated, and any patch that matches is
175 ignored.
176
bf8e65b3
DL
177--cover-from-description=<mode>::
178 Controls which parts of the cover letter will be automatically
179 populated using the branch's description.
180+
181If `<mode>` is `message` or `default`, the cover letter subject will be
182populated with placeholder text. The body of the cover letter will be
183populated with the branch's description. This is the default mode when
184no configuration nor command line option is specified.
185+
186If `<mode>` is `subject`, the first paragraph of the branch description will
187populate the cover letter subject. The remainder of the description will
188populate the body of the cover letter.
189+
190If `<mode>` is `auto`, if the first paragraph of the branch description
191is greater than 100 bytes, then the mode will be `message`, otherwise
192`subject` will be used.
193+
194If `<mode>` is `none`, both the cover letter subject and body will be
195populated with placeholder text.
196
c1a6f21c 197--subject-prefix=<subject prefix>::
2d9e4a47 198 Instead of the standard '[PATCH]' prefix in the subject
c1a6f21c 199 line, instead use '[<subject prefix>]'. This
2d9e4a47 200 allows for useful naming of a patch series, and can be
dce5ef14 201 combined with the `--numbered` option.
2d9e4a47 202
68e83a5b
JT
203--rfc::
204 Alias for `--subject-prefix="RFC PATCH"`. RFC means "Request For
205 Comments"; use this when sending an experimental patch for
206 discussion rather than application.
207
7952ea66 208-v <n>::
4aad08e0
JH
209--reroll-count=<n>::
210 Mark the series as the <n>-th iteration of the topic. The
d614f075 211 output filenames have `v<n>` prepended to them, and the
4aad08e0
JH
212 subject prefix ("PATCH" by default, but configurable via the
213 `--subject-prefix` option) has ` v<n>` appended to it. E.g.
214 `--reroll-count=4` may produce `v4-0001-add-makefile.patch`
215 file that has "Subject: [PATCH v4 1/20] Add makefile" in it.
216
ae6c098f
SD
217--to=<email>::
218 Add a `To:` header to the email headers. This is in addition
219 to any configured headers, and may be used multiple times.
b2cd17b9
TR
220 The negated form `--no-to` discards all `To:` headers added so
221 far (from config or command line).
ae6c098f 222
736cc67d 223--cc=<email>::
dce5ef14 224 Add a `Cc:` header to the email headers. This is in addition
736cc67d 225 to any configured headers, and may be used multiple times.
b2cd17b9
TR
226 The negated form `--no-cc` discards all `Cc:` headers added so
227 far (from config or command line).
736cc67d 228
a9080475
JK
229--from::
230--from=<ident>::
231 Use `ident` in the `From:` header of each commit email. If the
232 author ident of the commit is not textually identical to the
233 provided `ident`, place a `From:` header in the body of the
234 message with the original author. If no `ident` is given, use
235 the committer ident.
236+
237Note that this option is only useful if you are actually sending the
238emails and want to identify yourself as the sender, but retain the
239original author (and `git am` will correctly pick up the in-body
240header). Note also that `git send-email` already handles this
241transformation for you, and this option should not be used if you are
242feeding the result to `git send-email`.
243
d7d9c2d0
MH
244--add-header=<header>::
245 Add an arbitrary header to the email headers. This is in addition
246 to any configured headers, and may be used multiple times.
b2cd17b9
TR
247 For example, `--add-header="Organization: git-foo"`.
248 The negated form `--no-add-header` discards *all* (`To:`,
249 `Cc:`, and custom) headers added so far from config or command
250 line.
d7d9c2d0 251
2a4c2607 252--[no-]cover-letter::
f4912391 253 In addition to the patches, generate a cover letter file
561d2b79 254 containing the branch description, shortlog and the overall diffstat. You can
f4912391 255 fill in a description in the file before sending it out.
a5a27c79 256
19d097e3
EB
257--encode-email-headers::
258--no-encode-email-headers::
259 Encode email headers that have non-ASCII characters with
260 "Q-encoding" (described in RFC 2047), instead of outputting the
261 headers verbatim. Defaults to the value of the
262 `format.encodeEmailHeaders` configuration variable.
263
126facf8 264--interdiff=<previous>::
ee6cbf71
ES
265 As a reviewer aid, insert an interdiff into the cover letter,
266 or as commentary of the lone patch of a 1-patch series, showing
126facf8
ES
267 the differences between the previous version of the patch series and
268 the series currently being formatted. `previous` is a single revision
269 naming the tip of the previous series which shares a common base with
270 the series being formatted (for example `git format-patch
271 --cover-letter --interdiff=feature/v1 -3 feature/v2`).
272
31e2617a
ES
273--range-diff=<previous>::
274 As a reviewer aid, insert a range-diff (see linkgit:git-range-diff[1])
40ce4160
ES
275 into the cover letter, or as commentary of the lone patch of a
276 1-patch series, showing the differences between the previous
31e2617a 277 version of the patch series and the series currently being formatted.
2e6fd71a
ES
278 `previous` can be a single revision naming the tip of the previous
279 series if it shares a common base with the series being formatted (for
31e2617a 280 example `git format-patch --cover-letter --range-diff=feature/v1 -3
2e6fd71a
ES
281 feature/v2`), or a revision range if the two versions of the series are
282 disjoint (for example `git format-patch --cover-letter
283 --range-diff=feature/v1~3..feature/v1 -3 feature/v2`).
d8981c3f
JH
284+
285Note that diff options passed to the command affect how the primary
286product of `format-patch` is generated, and they are not passed to
287the underlying `range-diff` machinery used to generate the cover-letter
288material (this may change in the future).
31e2617a 289
8631bf1c
ES
290--creation-factor=<percent>::
291 Used with `--range-diff`, tweak the heuristic which matches up commits
292 between the previous and current series of patches by adjusting the
293 creation/deletion cost fudge factor. See linkgit:git-range-diff[1])
294 for details.
295
e422c0cf 296--notes[=<ref>]::
83d9db78 297--no-notes::
e422c0cf
JH
298 Append the notes (see linkgit:git-notes[1]) for the commit
299 after the three-dash line.
300+
301The expected use case of this is to write supporting explanation for
6454d9f1
PO
302the commit that does not belong to the commit log message proper,
303and include it with the patch submission. While one can simply write
304these explanations after `format-patch` has run but before sending,
2de9b711 305keeping them as Git notes allows them to be maintained between versions
6454d9f1
PO
306of the patch series (but see the discussion of the `notes.rewrite`
307configuration options in linkgit:git-notes[1] to use this workflow).
13cdf780
DL
308+
309The default is `--no-notes`, unless the `format.notes` configuration is
310set.
e422c0cf 311
2c7ee986 312--[no-]signature=<signature>::
6622d9c7
SB
313 Add a signature to each message produced. Per RFC 3676 the signature
314 is separated from the body by a line with '-- ' on it. If the
2de9b711 315 signature option is omitted the signature defaults to the Git version
6622d9c7
SB
316 number.
317
7022650f
JM
318--signature-file=<file>::
319 Works just like --signature except the signature is read from a file.
320
03eeaeae 321--suffix=.<sfx>::
917a8f89 322 Instead of using `.patch` as the suffix for generated
02783075 323 filenames, use specified suffix. A common alternative is
50710ce4
SB
324 `--suffix=.txt`. Leaving this empty will remove the `.patch`
325 suffix.
03eeaeae 326+
50710ce4
SB
327Note that the leading character does not have to be a dot; for example,
328you can use `--suffix=-patch` to get `0001-description-of-my-change-patch`.
03eeaeae 329
b7df098c 330-q::
b781cfaf
CMN
331--quiet::
332 Do not print the names of the generated files to standard output.
333
37c22a4b 334--no-binary::
50710ce4
SB
335 Do not output contents of changes in binary files, instead
336 display a notice that those files changed. Patches generated
337 using this option cannot be applied properly, but they are
338 still useful for code review.
37c22a4b 339
3a30aa17 340--zero-commit::
341 Output an all-zero hash in each patch's From header instead
342 of the hash of the commit.
343
945dc55d 344--[no-]base[=<commit>]::
fa2ab86d
XY
345 Record the base tree information to identify the state the
346 patch series applies to. See the BASE TREE INFORMATION section
c1a6f21c 347 below for details. If <commit> is "auto", a base commit is
945dc55d
DL
348 automatically chosen. The `--no-base` option overrides a
349 `format.useAutoBase` configuration.
fa2ab86d 350
2d266f9d
TR
351--root::
352 Treat the revision argument as a <revision range>, even if it
353 is just a single commit (that would normally be treated as a
354 <since>). Note that root commits included in the specified
355 range are always formatted as creation patches, independently
356 of this flag.
357
738e88a2
KW
358--progress::
359 Show progress reports on stderr as patches are generated.
360
96ce6d26
MM
361CONFIGURATION
362-------------
50710ce4
SB
363You can specify extra mail header lines to be added to each message,
364defaults for the subject prefix and file suffix, number patches when
c1a6f21c
DL
365outputting more than one patch, add "To:" or "Cc:" headers, configure
366attachments, change the patch output directory, and sign off patches
367with configuration variables.
96ce6d26 368
917a8f89 369------------
96ce6d26 370[format]
7f9d77f2 371 headers = "Organization: git-foo\n"
da0005b8 372 subjectPrefix = CHANGE
7f9d77f2
JN
373 suffix = .txt
374 numbered = auto
ae6c098f 375 to = <email>
fe8928e6 376 cc = <email>
0db5260b 377 attach [ = mime-boundary-string ]
da0005b8 378 signOff = true
c1a6f21c
DL
379 outputDirectory = <directory>
380 coverLetter = auto
bf8e65b3 381 coverFromDescription = auto
917a8f89 382------------
03eeaeae 383
96ce6d26 384
e0d48279
JN
385DISCUSSION
386----------
387
388The patch produced by 'git format-patch' is in UNIX mailbox format,
389with a fixed "magic" time stamp to indicate that the file is output
390from format-patch rather than a real mailbox, like so:
391
392------------
393From 8f72bad1baf19a53459661343e21d6491c3908d3 Mon Sep 17 00:00:00 2001
394From: Tony Luck <tony.luck@intel.com>
395Date: Tue, 13 Jul 2010 11:42:54 -0700
396Subject: [PATCH] =?UTF-8?q?[IA64]=20Put=20ia64=20config=20files=20on=20the=20?=
397 =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig=20diet?=
398MIME-Version: 1.0
399Content-Type: text/plain; charset=UTF-8
400Content-Transfer-Encoding: 8bit
401
402arch/arm config files were slimmed down using a python script
403(See commit c2330e286f68f1c408b4aa6515ba49d57f05beae comment)
404
405Do the same for ia64 so we can have sleek & trim looking
406...
407------------
408
409Typically it will be placed in a MUA's drafts folder, edited to add
410timely commentary that should not go in the changelog after the three
411dashes, and then sent as a message whose body, in our example, starts
412with "arch/arm config files were...". On the receiving end, readers
413can save interesting patches in a UNIX mailbox and apply them with
414linkgit:git-am[1].
415
416When a patch is part of an ongoing discussion, the patch generated by
417'git format-patch' can be tweaked to take advantage of the 'git am
418--scissors' feature. After your response to the discussion comes a
419line that consists solely of "`-- >8 --`" (scissors and perforation),
420followed by the patch with unnecessary header fields removed:
421
422------------
423...
424> So we should do such-and-such.
425
426Makes sense to me. How about this patch?
427
428-- >8 --
429Subject: [IA64] Put ia64 config files on the Uwe Kleine-König diet
430
431arch/arm config files were slimmed down using a python script
432...
433------------
434
435When sending a patch this way, most often you are sending your own
436patch, so in addition to the "`From $SHA1 $magic_timestamp`" marker you
437should omit `From:` and `Date:` lines from the patch file. The patch
438title is likely to be different from the subject of the discussion the
439patch is in response to, so it is likely that you would want to keep
440the Subject: line, like the example above.
441
57756161
JN
442Checking for patch corruption
443~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
444Many mailers if not set up properly will corrupt whitespace. Here are
445two common types of corruption:
446
447* Empty context lines that do not have _any_ whitespace.
448
449* Non-empty context lines that have one extra whitespace at the
450 beginning.
451
452One way to test if your MUA is set up correctly is:
453
454* Send the patch to yourself, exactly the way you would, except
455 with To: and Cc: lines that do not contain the list and
456 maintainer address.
457
458* Save that patch to a file in UNIX mailbox format. Call it a.patch,
459 say.
460
461* Apply it:
462
463 $ git fetch <project> master:test-apply
328c6cb8 464 $ git switch test-apply
80f537f7 465 $ git restore --source=HEAD --staged --worktree :/
57756161
JN
466 $ git am a.patch
467
468If it does not apply correctly, there can be various reasons.
469
470* The patch itself does not apply cleanly. That is _bad_ but
471 does not have much to do with your MUA. You might want to rebase
472 the patch with linkgit:git-rebase[1] before regenerating it in
473 this case.
474
475* The MUA corrupted your patch; "am" would complain that
476 the patch does not apply. Look in the .git/rebase-apply/ subdirectory and
477 see what 'patch' file contains and check for the common
478 corruption patterns mentioned above.
479
480* While at it, check the 'info' and 'final-commit' files as well.
481 If what is in 'final-commit' is not exactly what you would want to
482 see in the commit log message, it is very likely that the
483 receiver would end up hand editing the log message when applying
484 your patch. Things like "Hi, this is my first patch.\n" in the
485 patch e-mail should come after the three-dash line that signals
486 the end of the commit message.
487
dc53151f
JN
488MUA-SPECIFIC HINTS
489------------------
490Here are some hints on how to successfully submit patches inline using
491various mailers.
492
36c10e6d
JN
493GMail
494~~~~~
495GMail does not have any way to turn off line wrapping in the web
496interface, so it will mangle any emails that you send. You can however
497use "git send-email" and send your patches through the GMail SMTP server, or
498use any IMAP email client to connect to the google IMAP server and forward
499the emails through that.
500
501For hints on using 'git send-email' to send your patches through the
502GMail SMTP server, see the EXAMPLE section of linkgit:git-send-email[1].
503
504For hints on submission using the IMAP interface, see the EXAMPLE
505section of linkgit:git-imap-send[1].
506
dc53151f
JN
507Thunderbird
508~~~~~~~~~~~
509By default, Thunderbird will both wrap emails as well as flag
510them as being 'format=flowed', both of which will make the
2de9b711 511resulting email unusable by Git.
dc53151f 512
b8959605
JS
513There are three different approaches: use an add-on to turn off line wraps,
514configure Thunderbird to not mangle patches, or use
dc53151f
JN
515an external editor to keep Thunderbird from mangling the patches.
516
b8959605
JS
517Approach #1 (add-on)
518^^^^^^^^^^^^^^^^^^^^
519
520Install the Toggle Word Wrap add-on that is available from
521https://addons.mozilla.org/thunderbird/addon/toggle-word-wrap/
522It adds a menu entry "Enable Word Wrap" in the composer's "Options" menu
523that you can tick off. Now you can compose the message as you otherwise do
524(cut + paste, 'git format-patch' | 'git imap-send', etc), but you have to
525insert line breaks manually in any text that you type.
526
527Approach #2 (configuration)
dc53151f
JN
528^^^^^^^^^^^^^^^^^^^^^^^^^^^
529Three steps:
530
5311. Configure your mail server composition as plain text:
532 Edit...Account Settings...Composition & Addressing,
533 uncheck "Compose Messages in HTML".
534
5352. Configure your general composition window to not wrap.
536+
537In Thunderbird 2:
538Edit..Preferences..Composition, wrap plain text messages at 0
539+
540In Thunderbird 3:
541Edit..Preferences..Advanced..Config Editor. Search for
542"mail.wrap_long_lines".
f737684d
RJ
543Toggle it to make sure it is set to `false`. Also, search for
544"mailnews.wraplength" and set the value to 0.
dc53151f
JN
545
5463. Disable the use of format=flowed:
ba170517
JNA
547 Edit..Preferences..Advanced..Config Editor. Search for
548 "mailnews.send_plaintext_flowed".
549 Toggle it to make sure it is set to `false`.
dc53151f
JN
550
551After that is done, you should be able to compose email as you
552otherwise would (cut + paste, 'git format-patch' | 'git imap-send', etc),
553and the patches will not be mangled.
554
b8959605 555Approach #3 (external editor)
dc53151f
JN
556^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
557
558The following Thunderbird extensions are needed:
559AboutConfig from http://aboutconfig.mozdev.org/ and
560External Editor from http://globs.org/articles.php?lng=en&pg=8
561
5621. Prepare the patch as a text file using your method of choice.
563
5642. Before opening a compose window, use Edit->Account Settings to
565 uncheck the "Compose messages in HTML format" setting in the
566 "Composition & Addressing" panel of the account to be used to
567 send the patch.
568
5693. In the main Thunderbird window, 'before' you open the compose
570 window for the patch, use Tools->about:config to set the
571 following to the indicated values:
572+
573----------
574 mailnews.send_plaintext_flowed => false
575 mailnews.wraplength => 0
576----------
577
5784. Open a compose window and click the external editor icon.
579
5805. In the external editor window, read in the patch file and exit
581 the editor normally.
582
583Side note: it may be possible to do step 2 with
584about:config and the following settings but no one's tried yet.
585
586----------
587 mail.html_compose => false
588 mail.identity.default.compose_html => false
589 mail.identity.id?.compose_html => false
590----------
591
592There is a script in contrib/thunderbird-patch-inline which can help
593you include patches with Thunderbird in an easy way. To use it, do the
594steps above and then use the script as the external editor.
595
967ab8ef
JN
596KMail
597~~~~~
598This should help you to submit patches inline using KMail.
599
6001. Prepare the patch as a text file.
601
6022. Click on New Mail.
603
6043. Go under "Options" in the Composer window and be sure that
605 "Word wrap" is not set.
606
6074. Use Message -> Insert file... and insert the patch.
608
6095. Back in the compose window: add whatever other text you wish to the
610 message, complete the addressing and subject fields, and press send.
611
fa2ab86d
XY
612BASE TREE INFORMATION
613---------------------
614
615The base tree information block is used for maintainers or third party
616testers to know the exact state the patch series applies to. It consists
617of the 'base commit', which is a well-known commit that is part of the
618stable part of the project history everybody else works off of, and zero
619or more 'prerequisite patches', which are well-known patches in flight
620that is not yet part of the 'base commit' that need to be applied on top
621of 'base commit' in topological order before the patches can be applied.
622
623The 'base commit' is shown as "base-commit: " followed by the 40-hex of
624the commit object name. A 'prerequisite patch' is shown as
625"prerequisite-patch-id: " followed by the 40-hex 'patch id', which can
626be obtained by passing the patch through the `git patch-id --stable`
627command.
628
629Imagine that on top of the public commit P, you applied well-known
630patches X, Y and Z from somebody else, and then built your three-patch
631series A, B, C, the history would be like:
632
633................................................
634---P---X---Y---Z---A---B---C
635................................................
636
637With `git format-patch --base=P -3 C` (or variants thereof, e.g. with
7ba1ceef 638`--cover-letter` or using `Z..C` instead of `-3 C` to specify the
fa2ab86d
XY
639range), the base tree information block is shown at the end of the
640first message the command outputs (either the first patch, or the
641cover letter), like this:
642
643------------
644base-commit: P
645prerequisite-patch-id: X
646prerequisite-patch-id: Y
647prerequisite-patch-id: Z
648------------
649
650For non-linear topology, such as
651
652................................................
653---P---X---A---M---C
654 \ /
655 Y---Z---B
656................................................
657
658You can also use `git format-patch --base=P -3 C` to generate patches
659for A, B and C, and the identifiers for P, X, Y, Z are appended at the
660end of the first message.
e0d48279 661
3de66517
XY
662If set `--base=auto` in cmdline, it will track base commit automatically,
663the base commit will be the merge base of tip commit of the remote-tracking
664branch and revision-range specified in cmdline.
665For a local branch, you need to track a remote branch by `git branch
666--set-upstream-to` before using this option.
667
28ffb898
JH
668EXAMPLES
669--------
670
921177f5 671* Extract commits between revisions R1 and R2, and apply them on top of
ba170517 672 the current branch using 'git am' to cherry-pick them:
921177f5
CC
673+
674------------
467c0197 675$ git format-patch -k --stdout R1..R2 | git am -3 -k
921177f5
CC
676------------
677
678* Extract all commits which are in the current branch but not in the
ba170517 679 origin branch:
921177f5
CC
680+
681------------
682$ git format-patch origin
683------------
684+
685For each commit a separate file is created in the current directory.
686
687* Extract all commits that lead to 'origin' since the inception of the
ba170517 688 project:
921177f5
CC
689+
690------------
9c67c757 691$ git format-patch --root origin
921177f5
CC
692------------
693
694* The same as the previous one:
695+
696------------
697$ git format-patch -M -B origin
698------------
699+
700Additionally, it detects and handles renames and complete rewrites
701intelligently to produce a renaming patch. A renaming patch reduces
50710ce4 702the amount of text output, and generally makes it easier to review.
2de9b711
TA
703Note that non-Git "patch" programs won't understand renaming patches, so
704use it only when you know the recipient uses Git to apply your patch.
921177f5
CC
705
706* Extract three topmost commits from the current branch and format them
ba170517 707 as e-mailable patches:
921177f5
CC
708+
709------------
710$ git format-patch -3
711------------
28ffb898 712
56ae8df5 713SEE ALSO
28ffb898 714--------
5162e697 715linkgit:git-am[1], linkgit:git-send-email[1]
28ffb898 716
7fc9d69f
JH
717GIT
718---
9e1f0a85 719Part of the linkgit:git[1] suite