blob: a33d157b970740aa7d056ebb459350de89513a8b [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231git-format-patch(1)
2===================
3
4NAME
5----
Junio C Hamano01078922006-03-10 00:31:476git-format-patch - Prepare patches for e-mail submission
Junio C Hamano1a4e8412005-12-27 08:17:237
8
9SYNOPSIS
10--------
Junio C Hamano235a91e2006-01-07 01:13:5811[verse]
Junio C Hamanoc51fede2007-03-12 07:29:2012'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--thread]
Junio C Hamano6f1cca82007-04-12 05:02:4713 [--attach[=<boundary>] | --inline[=<boundary>]]
14 [-s | --signoff] [<common diff options>] [--start-number <n>]
15 [--in-reply-to=Message-Id] [--suffix=.<sfx>]
16 [--ignore-if-in-upstream]
17 [--subject-prefix=Subject-Prefix]
18 <since>[..<until>]
Junio C Hamano1a4e8412005-12-27 08:17:2319
20DESCRIPTION
21-----------
Junio C Hamano341071d2006-06-04 07:24:4822
23Prepare each commit between <since> and <until> with its patch in
24one file per commit, formatted to resemble UNIX mailbox format.
25If ..<until> is not specified, the head of the current working
Junio C Hamano2d47c622007-01-18 06:24:1026tree is implied. For a more complete list of ways to spell
27<since> and <until>, see "SPECIFYING REVISIONS" section in
28gitlink:git-rev-parse[1].
Junio C Hamano341071d2006-06-04 07:24:4829
30The output of this command is convenient for e-mail submission or
31for use with gitlink:git-am[1].
Junio C Hamano1a4e8412005-12-27 08:17:2332
Junio C Hamano38de0a22006-02-07 10:24:3533Each output file is numbered sequentially from 1, and uses the
Junio C Hamano341071d2006-06-04 07:24:4834first line of the commit message (massaged for pathname safety) as
35the filename. The names of the output files are printed to standard
36output, unless the --stdout option is specified.
Junio C Hamano38de0a22006-02-07 10:24:3537
Junio C Hamano341071d2006-06-04 07:24:4838If -o is specified, output files are created in <dir>. Otherwise
39they are created in the current working directory.
Junio C Hamano1a4e8412005-12-27 08:17:2340
Junio C Hamano341071d2006-06-04 07:24:4841If -n is specified, instead of "[PATCH] Subject", the first line
42is formatted as "[PATCH n/m] Subject".
Junio C Hamano1a4e8412005-12-27 08:17:2343
Junio C Hamanof9ca97d2006-07-25 22:23:0944If given --thread, git-format-patch will generate In-Reply-To and
45References headers to make the second and subsequent patch mails appear
46as replies to the first mail; this also generates a Message-Id header to
47reference.
Junio C Hamano1a4e8412005-12-27 08:17:2348
49OPTIONS
50-------
Junio C Hamano60f8aa82007-03-06 09:58:2651include::diff-options.txt[]
52
Junio C Hamano1a4e8412005-12-27 08:17:2353-o|--output-directory <dir>::
54Use <dir> to store the resulting files, instead of the
Junio C Hamano1bab4b02006-06-06 21:58:3355current working directory.
Junio C Hamano1a4e8412005-12-27 08:17:2356
57-n|--numbered::
58Name output in '[PATCH n/m]' format.
59
Junio C Hamano341071d2006-06-04 07:24:4860--start-number <n>::
61Start numbering the patches at <n> instead of 1.
62
Junio C Hamano1a4e8412005-12-27 08:17:2363-k|--keep-subject::
64Do not strip/add '[PATCH]' from the first line of the
65commit log message.
66
Junio C Hamano1a4e8412005-12-27 08:17:2367-s|--signoff::
68Add `Signed-off-by:` line to the commit message, using
69the committer identity of yourself.
70
Junio C Hamano1a4e8412005-12-27 08:17:2371--stdout::
Junio C Hamano341071d2006-06-04 07:24:4872Print all commits to the standard output in mbox format,
73instead of creating a file for each one.
Junio C Hamano1a4e8412005-12-27 08:17:2374
Junio C Hamanoc51fede2007-03-12 07:29:2075--attach[=<boundary>]::
76Create multipart/mixed attachment, the first part of
77which is the commit message and the patch itself in the
78second part, with "Content-Disposition: attachment".
79
80--inline[=<boundary>]::
81Create multipart/mixed attachment, the first part of
82which is the commit message and the patch itself in the
83second part, with "Content-Disposition: inline".
Junio C Hamano2496ae42006-03-11 08:04:3384
Junio C Hamanof9ca97d2006-07-25 22:23:0985--thread::
86Add In-Reply-To and References headers to make the second and
87subsequent mails appear as replies to the first. Also generates
88the Message-Id header to reference.
89
90--in-reply-to=Message-Id::
91Make the first mail (or all the mails with --no-thread) appear as a
92reply to the given Message-Id, which avoids breaking threads to
93provide a new patch series.
Junio C Hamano2496ae42006-03-11 08:04:3394
Junio C Hamano7c73c662007-01-19 00:37:5095--ignore-if-in-upstream::
96Do not include a patch that matches a commit in
97<until>..<since>. This will examine all patches reachable
98from <since> but not from <until> and compare them with the
99patches being generated, and any patch that matches is
100ignored.
101
Junio C Hamano6f1cca82007-04-12 05:02:47102--subject-prefix=<Subject-Prefix>::
103Instead of the standard '[PATCH]' prefix in the subject
104line, instead use '[<Subject-Prefix>]'. This
105allows for useful naming of a patch series, and can be
106combined with the --numbered option.
107
Junio C Hamano4f9a6052007-01-17 20:25:16108--suffix=.<sfx>::
Junio C Hamano7c73c662007-01-19 00:37:50109Instead of using `.patch` as the suffix for generated
Junio C Hamano4f9a6052007-01-17 20:25:16110filenames, use specifed suffix. A common alternative is
Junio C Hamano7c73c662007-01-19 00:37:50111`--suffix=.txt`.
Junio C Hamano4f9a6052007-01-17 20:25:16112+
113Note that you would need to include the leading dot `.` if you
114want a filename like `0001-description-of-my-change.patch`, and
115the first letter does not have to be a dot. Leaving it empty would
116not add any suffix.
117
Junio C Hamano2496ae42006-03-11 08:04:33118CONFIGURATION
119-------------
120You can specify extra mail header lines to be added to each
Junio C Hamano7c73c662007-01-19 00:37:50121message in the repository configuration. Also you can specify
122the default suffix different from the built-in one:
Junio C Hamano2496ae42006-03-11 08:04:33123
Junio C Hamano7c73c662007-01-19 00:37:50124------------
Junio C Hamano2496ae42006-03-11 08:04:33125[format]
126 headers = "Organization: git-foo\n"
Junio C Hamano7c73c662007-01-19 00:37:50127 suffix = .txt
128------------
Junio C Hamano4f9a6052007-01-17 20:25:16129
Junio C Hamano1a4e8412005-12-27 08:17:23130
131EXAMPLES
132--------
133
134git-format-patch -k --stdout R1..R2 | git-am -3 -k::
135Extract commits between revisions R1 and R2, and apply
136them on top of the current branch using `git-am` to
137cherry-pick them.
138
139git-format-patch origin::
Junio C Hamano341071d2006-06-04 07:24:48140Extract all commits which are in the current branch but
141not in the origin branch. For each commit a separate file
142is created in the current directory.
Junio C Hamano1a4e8412005-12-27 08:17:23143
144git-format-patch -M -B origin::
Junio C Hamano341071d2006-06-04 07:24:48145The same as the previous one. Additionally, it detects
146and handles renames and complete rewrites intelligently to
147produce a renaming patch. A renaming patch reduces the
148amount of text output, and generally makes it easier to
149review it. Note that the "patch" program does not
150understand renaming patches, so use it only when you know
151the recipient uses git to apply your patch.
Junio C Hamano1a4e8412005-12-27 08:17:23152
Junio C Hamano7c73c662007-01-19 00:37:50153git-format-patch -3::
154Extract three topmost commits from the current branch
155and format them as e-mailable patches.
Junio C Hamano1a4e8412005-12-27 08:17:23156
157See Also
158--------
Junio C Hamano235a91e2006-01-07 01:13:58159gitlink:git-am[1], gitlink:git-send-email[1]
Junio C Hamano1a4e8412005-12-27 08:17:23160
161
162Author
163------
164Written by Junio C Hamano <junkio@cox.net>
165
166Documentation
167--------------
168Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
169
170GIT
171---
172Part of the gitlink:git[7] suite
173