Junio C Hamano | 215a7ad | 2005-09-07 17:26:23 -0700 | [diff] [blame] | 1 | git-format-patch(1) |
| 2 | =================== |
Junio C Hamano | 7fc9d69 | 2005-08-23 01:49:47 -0700 | [diff] [blame] | 3 | |
| 4 | NAME |
| 5 | ---- |
Fredrik Kuivinen | 7bd7f28 | 2006-03-09 17:24:50 +0100 | [diff] [blame] | 6 | git-format-patch - Prepare patches for e-mail submission |
Junio C Hamano | 7fc9d69 | 2005-08-23 01:49:47 -0700 | [diff] [blame] | 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
Jonas Fonseca | 353ce81 | 2005-12-31 18:37:15 +0100 | [diff] [blame] | 11 | [verse] |
Johannes Schindelin | c112f68 | 2007-03-04 00:12:06 +0100 | [diff] [blame] | 12 | 'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--thread] |
Robin H. Johnson | 2d9e4a4 | 2007-04-11 16:58:07 -0700 | [diff] [blame] | 13 | [--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 Hamano | 7fc9d69 | 2005-08-23 01:49:47 -0700 | [diff] [blame] | 19 | |
| 20 | DESCRIPTION |
| 21 | ----------- |
Dennis Stosberg | 2052d14 | 2006-05-31 16:14:08 +0200 | [diff] [blame] | 22 | |
| 23 | Prepare each commit between <since> and <until> with its patch in |
| 24 | one file per commit, formatted to resemble UNIX mailbox format. |
| 25 | If ..<until> is not specified, the head of the current working |
Shawn O. Pearce | 41a5564 | 2007-01-17 21:08:09 -0500 | [diff] [blame] | 26 | tree is implied. For a more complete list of ways to spell |
| 27 | <since> and <until>, see "SPECIFYING REVISIONS" section in |
| 28 | gitlink:git-rev-parse[1]. |
Dennis Stosberg | 2052d14 | 2006-05-31 16:14:08 +0200 | [diff] [blame] | 29 | |
| 30 | The output of this command is convenient for e-mail submission or |
| 31 | for use with gitlink:git-am[1]. |
Junio C Hamano | 35ef3a4 | 2005-09-07 23:04:52 -0700 | [diff] [blame] | 32 | |
Andreas Ericsson | 66f04f3 | 2006-02-07 09:37:54 +0000 | [diff] [blame] | 33 | Each output file is numbered sequentially from 1, and uses the |
Dennis Stosberg | 2052d14 | 2006-05-31 16:14:08 +0200 | [diff] [blame] | 34 | first line of the commit message (massaged for pathname safety) as |
| 35 | the filename. The names of the output files are printed to standard |
| 36 | output, unless the --stdout option is specified. |
Andreas Ericsson | 66f04f3 | 2006-02-07 09:37:54 +0000 | [diff] [blame] | 37 | |
Dennis Stosberg | 2052d14 | 2006-05-31 16:14:08 +0200 | [diff] [blame] | 38 | If -o is specified, output files are created in <dir>. Otherwise |
| 39 | they are created in the current working directory. |
Junio C Hamano | 35ef3a4 | 2005-09-07 23:04:52 -0700 | [diff] [blame] | 40 | |
Dennis Stosberg | 2052d14 | 2006-05-31 16:14:08 +0200 | [diff] [blame] | 41 | If -n is specified, instead of "[PATCH] Subject", the first line |
| 42 | is formatted as "[PATCH n/m] Subject". |
Junio C Hamano | 35ef3a4 | 2005-09-07 23:04:52 -0700 | [diff] [blame] | 43 | |
Josh Triplett | cc35de8 | 2006-07-14 17:49:04 -0700 | [diff] [blame] | 44 | If given --thread, git-format-patch will generate In-Reply-To and |
| 45 | References headers to make the second and subsequent patch mails appear |
| 46 | as replies to the first mail; this also generates a Message-Id header to |
| 47 | reference. |
Junio C Hamano | 7fc9d69 | 2005-08-23 01:49:47 -0700 | [diff] [blame] | 48 | |
| 49 | OPTIONS |
| 50 | ------- |
Brian Gernhardt | b810537 | 2007-03-05 22:27:44 -0500 | [diff] [blame] | 51 | include::diff-options.txt[] |
| 52 | |
Nikolai Weibull | 6f85537 | 2005-12-09 00:28:05 +0100 | [diff] [blame] | 53 | -o|--output-directory <dir>:: |
Junio C Hamano | 35ef3a4 | 2005-09-07 23:04:52 -0700 | [diff] [blame] | 54 | Use <dir> to store the resulting files, instead of the |
Junio C Hamano | efd0201 | 2006-06-06 08:46:23 -0700 | [diff] [blame] | 55 | current working directory. |
Junio C Hamano | 7fc9d69 | 2005-08-23 01:49:47 -0700 | [diff] [blame] | 56 | |
Nikolai Weibull | 6f85537 | 2005-12-09 00:28:05 +0100 | [diff] [blame] | 57 | -n|--numbered:: |
Junio C Hamano | 35ef3a4 | 2005-09-07 23:04:52 -0700 | [diff] [blame] | 58 | Name output in '[PATCH n/m]' format. |
| 59 | |
Dennis Stosberg | 2052d14 | 2006-05-31 16:14:08 +0200 | [diff] [blame] | 60 | --start-number <n>:: |
| 61 | Start numbering the patches at <n> instead of 1. |
| 62 | |
Nikolai Weibull | 6f85537 | 2005-12-09 00:28:05 +0100 | [diff] [blame] | 63 | -k|--keep-subject:: |
Junio C Hamano | 35ef3a4 | 2005-09-07 23:04:52 -0700 | [diff] [blame] | 64 | Do not strip/add '[PATCH]' from the first line of the |
| 65 | commit log message. |
| 66 | |
Nikolai Weibull | 6f85537 | 2005-12-09 00:28:05 +0100 | [diff] [blame] | 67 | -s|--signoff:: |
| 68 | Add `Signed-off-by:` line to the commit message, using |
| 69 | the committer identity of yourself. |
| 70 | |
Junio C Hamano | 54ba601 | 2005-10-06 14:25:52 -0700 | [diff] [blame] | 71 | --stdout:: |
Dennis Stosberg | 2052d14 | 2006-05-31 16:14:08 +0200 | [diff] [blame] | 72 | Print all commits to the standard output in mbox format, |
| 73 | instead of creating a file for each one. |
Junio C Hamano | 7fc9d69 | 2005-08-23 01:49:47 -0700 | [diff] [blame] | 74 | |
Johannes Schindelin | c112f68 | 2007-03-04 00:12:06 +0100 | [diff] [blame] | 75 | --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 McCormack | a15a44e | 2006-03-10 13:47:24 +0900 | [diff] [blame] | 84 | |
Josh Triplett | cc35de8 | 2006-07-14 17:49:04 -0700 | [diff] [blame] | 85 | --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 Hamano | 28ffb89 | 2005-11-05 02:55:18 -0800 | [diff] [blame] | 89 | |
Josh Triplett | da56645 | 2006-07-14 17:49:08 -0700 | [diff] [blame] | 90 | --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ågedal | cc75ad6 | 2007-01-18 12:27:35 +0100 | [diff] [blame] | 95 | --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. Johnson | 2d9e4a4 | 2007-04-11 16:58:07 -0700 | [diff] [blame] | 102 | --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 Hamano | 03eeaea | 2007-01-17 11:12:03 -0800 | [diff] [blame] | 108 | --suffix=.<sfx>:: |
Junio C Hamano | 917a8f8 | 2007-01-17 15:03:39 -0800 | [diff] [blame] | 109 | Instead of using `.patch` as the suffix for generated |
Junio C Hamano | 03eeaea | 2007-01-17 11:12:03 -0800 | [diff] [blame] | 110 | filenames, use specifed suffix. A common alternative is |
Junio C Hamano | 917a8f8 | 2007-01-17 15:03:39 -0800 | [diff] [blame] | 111 | `--suffix=.txt`. |
Junio C Hamano | 03eeaea | 2007-01-17 11:12:03 -0800 | [diff] [blame] | 112 | + |
| 113 | Note that you would need to include the leading dot `.` if you |
| 114 | want a filename like `0001-description-of-my-change.patch`, and |
| 115 | the first letter does not have to be a dot. Leaving it empty would |
| 116 | not add any suffix. |
| 117 | |
Mike McCormack | 96ce6d2 | 2006-03-10 13:47:59 +0900 | [diff] [blame] | 118 | CONFIGURATION |
| 119 | ------------- |
| 120 | You can specify extra mail header lines to be added to each |
Junio C Hamano | 917a8f8 | 2007-01-17 15:03:39 -0800 | [diff] [blame] | 121 | message in the repository configuration. Also you can specify |
| 122 | the default suffix different from the built-in one: |
Mike McCormack | 96ce6d2 | 2006-03-10 13:47:59 +0900 | [diff] [blame] | 123 | |
Junio C Hamano | 917a8f8 | 2007-01-17 15:03:39 -0800 | [diff] [blame] | 124 | ------------ |
Mike McCormack | 96ce6d2 | 2006-03-10 13:47:59 +0900 | [diff] [blame] | 125 | [format] |
| 126 | headers = "Organization: git-foo\n" |
Junio C Hamano | 917a8f8 | 2007-01-17 15:03:39 -0800 | [diff] [blame] | 127 | suffix = .txt |
| 128 | ------------ |
Junio C Hamano | 03eeaea | 2007-01-17 11:12:03 -0800 | [diff] [blame] | 129 | |
Mike McCormack | 96ce6d2 | 2006-03-10 13:47:59 +0900 | [diff] [blame] | 130 | |
Junio C Hamano | 28ffb89 | 2005-11-05 02:55:18 -0800 | [diff] [blame] | 131 | EXAMPLES |
| 132 | -------- |
| 133 | |
| 134 | git-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 | |
| 139 | git-format-patch origin:: |
Dennis Stosberg | 2052d14 | 2006-05-31 16:14:08 +0200 | [diff] [blame] | 140 | 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 Hamano | 28ffb89 | 2005-11-05 02:55:18 -0800 | [diff] [blame] | 143 | |
Junio C Hamano | 803f498 | 2005-12-13 01:54:15 -0800 | [diff] [blame] | 144 | git-format-patch -M -B origin:: |
Dennis Stosberg | 2052d14 | 2006-05-31 16:14:08 +0200 | [diff] [blame] | 145 | 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 Hamano | 803f498 | 2005-12-13 01:54:15 -0800 | [diff] [blame] | 152 | |
Junio C Hamano | 7c49628 | 2007-01-17 13:35:13 -0800 | [diff] [blame] | 153 | git-format-patch -3:: |
| 154 | Extract three topmost commits from the current branch |
| 155 | and format them as e-mailable patches. |
Junio C Hamano | 28ffb89 | 2005-11-05 02:55:18 -0800 | [diff] [blame] | 156 | |
| 157 | See Also |
| 158 | -------- |
Jonas Fonseca | 353ce81 | 2005-12-31 18:37:15 +0100 | [diff] [blame] | 159 | gitlink:git-am[1], gitlink:git-send-email[1] |
Junio C Hamano | 28ffb89 | 2005-11-05 02:55:18 -0800 | [diff] [blame] | 160 | |
| 161 | |
Junio C Hamano | 7fc9d69 | 2005-08-23 01:49:47 -0700 | [diff] [blame] | 162 | Author |
| 163 | ------ |
| 164 | Written by Junio C Hamano <junkio@cox.net> |
| 165 | |
| 166 | Documentation |
| 167 | -------------- |
| 168 | Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>. |
| 169 | |
| 170 | GIT |
| 171 | --- |
Sergey Vlasov | a7154e9 | 2005-09-19 14:10:51 +0400 | [diff] [blame] | 172 | Part of the gitlink:git[7] suite |
Junio C Hamano | 7fc9d69 | 2005-08-23 01:49:47 -0700 | [diff] [blame] | 173 | |