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