1git-format-patch(1) 2=================== 3 4NAME 5---- 6git-format-patch - Prepare patches for e-mail submission 7 8 9SYNOPSIS 10-------- 11[verse] 12'git-format-patch' [<common diff options>] [-n | -k] [-o <dir> | --stdout] 13 [--attach] [--thread] [-s | --signoff] [--start-number <n>] 14 [--in-reply-to=Message-Id] [--suffix=.<sfx>] 15 [--ignore-if-in-upstream] 16 <since>[..<until>] 17 18DESCRIPTION 19----------- 20 21Prepare each commit between <since> and <until> with its patch in 22one file per commit, formatted to resemble UNIX mailbox format. 23If ..<until> is not specified, the head of the current working 24tree is implied. For a more complete list of ways to spell 25<since> and <until>, see "SPECIFYING REVISIONS" section in 26gitlink:git-rev-parse[1]. 27 28The output of this command is convenient for e-mail submission or 29for use with gitlink:git-am[1]. 30 31Each output file is numbered sequentially from 1, and uses the 32first line of the commit message (massaged for pathname safety) as 33the filename. The names of the output files are printed to standard 34output, unless the --stdout option is specified. 35 36If -o is specified, output files are created in <dir>. Otherwise 37they are created in the current working directory. 38 39If -n is specified, instead of "[PATCH] Subject", the first line 40is formatted as "[PATCH n/m] Subject". 41 42If given --thread, git-format-patch will generate In-Reply-To and 43References headers to make the second and subsequent patch mails appear 44as replies to the first mail; this also generates a Message-Id header to 45reference. 46 47OPTIONS 48------- 49include::diff-options.txt[] 50 51-o|--output-directory <dir>:: 52 Use <dir> to store the resulting files, instead of the 53 current working directory. 54 55-n|--numbered:: 56 Name output in '[PATCH n/m]' format. 57 58--start-number <n>:: 59 Start numbering the patches at <n> instead of 1. 60 61-k|--keep-subject:: 62 Do not strip/add '[PATCH]' from the first line of the 63 commit log message. 64 65-s|--signoff:: 66 Add `Signed-off-by:` line to the commit message, using 67 the committer identity of yourself. 68 69--stdout:: 70 Print all commits to the standard output in mbox format, 71 instead of creating a file for each one. 72 73--attach:: 74 Create attachments instead of inlining patches. 75 76--thread:: 77 Add In-Reply-To and References headers to make the second and 78 subsequent mails appear as replies to the first. Also generates 79 the Message-Id header to reference. 80 81--in-reply-to=Message-Id:: 82 Make the first mail (or all the mails with --no-thread) appear as a 83 reply to the given Message-Id, which avoids breaking threads to 84 provide a new patch series. 85 86--ignore-if-in-upstream:: 87 Do not include a patch that matches a commit in 88 <until>..<since>. This will examine all patches reachable 89 from <since> but not from <until> and compare them with the 90 patches being generated, and any patch that matches is 91 ignored. 92 93--suffix=.<sfx>:: 94 Instead of using `.patch` as the suffix for generated 95 filenames, use specifed suffix. A common alternative is 96 `--suffix=.txt`. 97+ 98Note that you would need to include the leading dot `.` if you 99want a filename like `0001-description-of-my-change.patch`, and 100the first letter does not have to be a dot. Leaving it empty would 101not add any suffix. 102 103CONFIGURATION 104------------- 105You can specify extra mail header lines to be added to each 106message in the repository configuration. Also you can specify 107the default suffix different from the built-in one: 108 109------------ 110[format] 111 headers = "Organization: git-foo\n" 112 suffix = .txt 113------------ 114 115 116EXAMPLES 117-------- 118 119git-format-patch -k --stdout R1..R2 | git-am -3 -k:: 120 Extract commits between revisions R1 and R2, and apply 121 them on top of the current branch using `git-am` to 122 cherry-pick them. 123 124git-format-patch origin:: 125 Extract all commits which are in the current branch but 126 not in the origin branch. For each commit a separate file 127 is created in the current directory. 128 129git-format-patch -M -B origin:: 130 The same as the previous one. Additionally, it detects 131 and handles renames and complete rewrites intelligently to 132 produce a renaming patch. A renaming patch reduces the 133 amount of text output, and generally makes it easier to 134 review it. Note that the "patch" program does not 135 understand renaming patches, so use it only when you know 136 the recipient uses git to apply your patch. 137 138git-format-patch -3:: 139 Extract three topmost commits from the current branch 140 and format them as e-mailable patches. 141 142See Also 143-------- 144gitlink:git-am[1], gitlink:git-send-email[1] 145 146 147Author 148------ 149Written by Junio C Hamano <junkio@cox.net> 150 151Documentation 152-------------- 153Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>. 154 155GIT 156--- 157Part of the gitlink:git[7] suite 158