blob: a33d157b970740aa7d056ebb459350de89513a8b [file] [log] [blame]
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001git-format-patch(1)
2===================
Junio C Hamano7fc9d692005-08-23 01:49:47 -07003
4NAME
5----
Fredrik Kuivinen7bd7f282006-03-09 17:24:50 +01006git-format-patch - Prepare patches for e-mail submission
Junio C Hamano7fc9d692005-08-23 01:49:47 -07007
8
9SYNOPSIS
10--------
Jonas Fonseca353ce812005-12-31 18:37:15 +010011[verse]
Johannes Schindelinc112f682007-03-04 00:12:06 +010012'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--thread]
Robin H. Johnson2d9e4a42007-04-11 16:58:07 -070013 [--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 Hamano7fc9d692005-08-23 01:49:47 -070019
20DESCRIPTION
21-----------
Dennis Stosberg2052d142006-05-31 16:14:08 +020022
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
Shawn O. Pearce41a55642007-01-17 21:08:09 -050026tree 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].
Dennis Stosberg2052d142006-05-31 16:14:08 +020029
30The output of this command is convenient for e-mail submission or
31for use with gitlink:git-am[1].
Junio C Hamano35ef3a42005-09-07 23:04:52 -070032
Andreas Ericsson66f04f32006-02-07 09:37:54 +000033Each output file is numbered sequentially from 1, and uses the
Dennis Stosberg2052d142006-05-31 16:14:08 +020034first 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.
Andreas Ericsson66f04f32006-02-07 09:37:54 +000037
Dennis Stosberg2052d142006-05-31 16:14:08 +020038If -o is specified, output files are created in <dir>. Otherwise
39they are created in the current working directory.
Junio C Hamano35ef3a42005-09-07 23:04:52 -070040
Dennis Stosberg2052d142006-05-31 16:14:08 +020041If -n is specified, instead of "[PATCH] Subject", the first line
42is formatted as "[PATCH n/m] Subject".
Junio C Hamano35ef3a42005-09-07 23:04:52 -070043
Josh Triplettcc35de82006-07-14 17:49:04 -070044If 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 Hamano7fc9d692005-08-23 01:49:47 -070048
49OPTIONS
50-------
Brian Gernhardtb8105372007-03-05 22:27:44 -050051include::diff-options.txt[]
52
Nikolai Weibull6f855372005-12-09 00:28:05 +010053-o|--output-directory <dir>::
Junio C Hamano35ef3a42005-09-07 23:04:52 -070054 Use <dir> to store the resulting files, instead of the
Junio C Hamanoefd02012006-06-06 08:46:23 -070055 current working directory.
Junio C Hamano7fc9d692005-08-23 01:49:47 -070056
Nikolai Weibull6f855372005-12-09 00:28:05 +010057-n|--numbered::
Junio C Hamano35ef3a42005-09-07 23:04:52 -070058 Name output in '[PATCH n/m]' format.
59
Dennis Stosberg2052d142006-05-31 16:14:08 +020060--start-number <n>::
61 Start numbering the patches at <n> instead of 1.
62
Nikolai Weibull6f855372005-12-09 00:28:05 +010063-k|--keep-subject::
Junio C Hamano35ef3a42005-09-07 23:04:52 -070064 Do not strip/add '[PATCH]' from the first line of the
65 commit log message.
66
Nikolai Weibull6f855372005-12-09 00:28:05 +010067-s|--signoff::
68 Add `Signed-off-by:` line to the commit message, using
69 the committer identity of yourself.
70
Junio C Hamano54ba6012005-10-06 14:25:52 -070071--stdout::
Dennis Stosberg2052d142006-05-31 16:14:08 +020072 Print all commits to the standard output in mbox format,
73 instead of creating a file for each one.
Junio C Hamano7fc9d692005-08-23 01:49:47 -070074
Johannes Schindelinc112f682007-03-04 00:12:06 +010075--attach[=<boundary>]::
76 Create multipart/mixed attachment, the first part of
77 which is the commit message and the patch itself in the
78 second part, with "Content-Disposition: attachment".
79
80--inline[=<boundary>]::
81 Create multipart/mixed attachment, the first part of
82 which is the commit message and the patch itself in the
83 second part, with "Content-Disposition: inline".
Mike McCormacka15a44e2006-03-10 13:47:24 +090084
Josh Triplettcc35de82006-07-14 17:49:04 -070085--thread::
86 Add In-Reply-To and References headers to make the second and
87 subsequent mails appear as replies to the first. Also generates
88 the Message-Id header to reference.
Junio C Hamano28ffb892005-11-05 02:55:18 -080089
Josh Triplettda566452006-07-14 17:49:08 -070090--in-reply-to=Message-Id::
91 Make the first mail (or all the mails with --no-thread) appear as a
92 reply to the given Message-Id, which avoids breaking threads to
93 provide a new patch series.
94
David Kågedalcc75ad62007-01-18 12:27:35 +010095--ignore-if-in-upstream::
96 Do not include a patch that matches a commit in
97 <until>..<since>. This will examine all patches reachable
98 from <since> but not from <until> and compare them with the
99 patches being generated, and any patch that matches is
100 ignored.
101
Robin H. Johnson2d9e4a42007-04-11 16:58:07 -0700102--subject-prefix=<Subject-Prefix>::
103 Instead of the standard '[PATCH]' prefix in the subject
104 line, instead use '[<Subject-Prefix>]'. This
105 allows for useful naming of a patch series, and can be
106 combined with the --numbered option.
107
Junio C Hamano03eeaea2007-01-17 11:12:03 -0800108--suffix=.<sfx>::
Junio C Hamano917a8f82007-01-17 15:03:39 -0800109 Instead of using `.patch` as the suffix for generated
Junio C Hamano03eeaea2007-01-17 11:12:03 -0800110 filenames, use specifed suffix. A common alternative is
Junio C Hamano917a8f82007-01-17 15:03:39 -0800111 `--suffix=.txt`.
Junio C Hamano03eeaea2007-01-17 11:12:03 -0800112+
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
Mike McCormack96ce6d22006-03-10 13:47:59 +0900118CONFIGURATION
119-------------
120You can specify extra mail header lines to be added to each
Junio C Hamano917a8f82007-01-17 15:03:39 -0800121message in the repository configuration. Also you can specify
122the default suffix different from the built-in one:
Mike McCormack96ce6d22006-03-10 13:47:59 +0900123
Junio C Hamano917a8f82007-01-17 15:03:39 -0800124------------
Mike McCormack96ce6d22006-03-10 13:47:59 +0900125[format]
126 headers = "Organization: git-foo\n"
Junio C Hamano917a8f82007-01-17 15:03:39 -0800127 suffix = .txt
128------------
Junio C Hamano03eeaea2007-01-17 11:12:03 -0800129
Mike McCormack96ce6d22006-03-10 13:47:59 +0900130
Junio C Hamano28ffb892005-11-05 02:55:18 -0800131EXAMPLES
132--------
133
134git-format-patch -k --stdout R1..R2 | git-am -3 -k::
135 Extract commits between revisions R1 and R2, and apply
136 them on top of the current branch using `git-am` to
137 cherry-pick them.
138
139git-format-patch origin::
Dennis Stosberg2052d142006-05-31 16:14:08 +0200140 Extract all commits which are in the current branch but
141 not in the origin branch. For each commit a separate file
142 is created in the current directory.
Junio C Hamano28ffb892005-11-05 02:55:18 -0800143
Junio C Hamano803f4982005-12-13 01:54:15 -0800144git-format-patch -M -B origin::
Dennis Stosberg2052d142006-05-31 16:14:08 +0200145 The same as the previous one. Additionally, it detects
146 and handles renames and complete rewrites intelligently to
147 produce a renaming patch. A renaming patch reduces the
148 amount of text output, and generally makes it easier to
149 review it. Note that the "patch" program does not
150 understand renaming patches, so use it only when you know
151 the recipient uses git to apply your patch.
Junio C Hamano803f4982005-12-13 01:54:15 -0800152
Junio C Hamano7c496282007-01-17 13:35:13 -0800153git-format-patch -3::
154 Extract three topmost commits from the current branch
155 and format them as e-mailable patches.
Junio C Hamano28ffb892005-11-05 02:55:18 -0800156
157See Also
158--------
Jonas Fonseca353ce812005-12-31 18:37:15 +0100159gitlink:git-am[1], gitlink:git-send-email[1]
Junio C Hamano28ffb892005-11-05 02:55:18 -0800160
161
Junio C Hamano7fc9d692005-08-23 01:49:47 -0700162Author
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---
Sergey Vlasova7154e92005-09-19 14:10:51 +0400172Part of the gitlink:git[7] suite
Junio C Hamano7fc9d692005-08-23 01:49:47 -0700173