Home Explore Blog CI



git

2nd chunk of `Documentation/git-format-patch.adoc`
6c902389e350e2c9e57ba939a4cbd69dbe16d09f947744ca0000000100000fa6
 printed to standard
output, unless the `--stdout` option is specified.

If `-o` is specified, output files are created in <dir>.  Otherwise
they are created in the current working directory. The default path
can be set with the `format.outputDirectory` configuration option.
The `-o` option takes precedence over `format.outputDirectory`.
To store patches in the current working directory even when
`format.outputDirectory` points elsewhere, use `-o .`. All directory
components will be created.

By default, the subject of a single patch is "[PATCH] " followed by
the concatenation of lines from the commit message up to the first blank
line (see the DISCUSSION section of linkgit:git-commit[1]).

When multiple patches are output, the subject prefix will instead be
"[PATCH n/m] ".  To force 1/1 to be added for a single patch, use `-n`.
To omit patch numbers from the subject, use `-N`.

If given `--thread`, `git-format-patch` will generate `In-Reply-To` and
`References` headers to make the second and subsequent patch mails appear
as replies to the first mail; this also generates a `Message-ID` header to
reference.

OPTIONS
-------
:git-format-patch: 1
include::diff-options.adoc[]

-<n>::
	Prepare patches from the topmost <n> commits.

-o <dir>::
--output-directory <dir>::
	Use <dir> to store the resulting files, instead of the
	current working directory.

-n::
--numbered::
	Name output in '[PATCH n/m]' format, even with a single patch.

-N::
--no-numbered::
	Name output in '[PATCH]' format.

--start-number <n>::
	Start numbering the patches at <n> instead of 1.

--numbered-files::
	Output file names will be a simple number sequence
	without the default first line of the commit appended.

-k::
--keep-subject::
	Do not strip/add '[PATCH]' from the first line of the
	commit log message.

-s::
--signoff::
	Add a `Signed-off-by` trailer to the commit message, using
	the committer identity of yourself.
	See the signoff option in linkgit:git-commit[1] for more information.

--stdout::
	Print all commits to the standard output in mbox format,
	instead of creating a file for each one.

--attach[=<boundary>]::
	Create multipart/mixed attachment, the first part of
	which is the commit message and the patch itself in the
	second part, with `Content-Disposition: attachment`.

--no-attach::
	Disable the creation of an attachment, overriding the
	configuration setting.

--inline[=<boundary>]::
	Create multipart/mixed attachment, the first part of
	which is the commit message and the patch itself in the
	second part, with `Content-Disposition: inline`.

--thread[=<style>]::
--no-thread::
	Controls addition of `In-Reply-To` and `References` headers to
	make the second and subsequent mails appear as replies to the
	first.  Also controls generation of the `Message-ID` header to
	reference.
+
The optional <style> argument can be either `shallow` or `deep`.
'shallow' threading makes every mail a reply to the head of the
series, where the head is chosen from the cover letter, the
`--in-reply-to`, and the first patch mail, in this order.  'deep'
threading makes every mail a reply to the previous one.
+
The default is `--no-thread`, unless the `format.thread` configuration
is set.  `--thread` without an argument is equivalent to `--thread=shallow`.
+
Beware that the default for 'git send-email' is to thread emails
itself.  If you want `git format-patch` to take care of threading, you
will want to ensure that threading is disabled for `git send-email`.

--in-reply-to=<message-id>::
	Make the first mail (or all the mails with `--no-thread`) appear as a
	reply to the given <message-id>, which avoids breaking threads to
	provide a new patch series.

--ignore-if-in-upstream::
	Do not include a patch that matches a commit in
	<until>..<since>.  This will examine all patches reachable
	from <since> but not from <until> and compare them with the
	patches being generated, and any patch that matches is
	ignored.

--always::
	Include patches for commits that do not introduce

Title: Git Format Patch Options
Summary
The git-format-patch command offers various options to customize the output, including options for naming output files, threading, signing off, and attaching patches, allowing for flexible generation of patch files for e-mail submission or use with 'git am'.