1 git-format-patch(1)
2 ===================
4 NAME
5 ----
6 git-format-patch - Prepare patches for e-mail submission
9 SYNOPSIS
10 --------
11 [verse]
12 'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--attach] [-s] [-c]
13 [--diff-options] <his> [<mine>]
15 DESCRIPTION
16 -----------
17 Prepare each commit with its patch since <mine> head forked from
18 <his> head, one file per patch formatted to resemble UNIX mailbox
19 format, for e-mail submission or use with gitlink:git-am[1].
21 Each output file is numbered sequentially from 1, and uses the
22 first line of the commit message (massaged for pathname safety)
23 as the filename.
25 When -o is specified, output files are created in <dir>; otherwise
26 they are created in the current working directory. This option
27 is ignored if --stdout is specified.
29 When -n is specified, instead of "[PATCH] Subject", the first
30 line is formatted as "[PATCH N/M] Subject", unless you have only
31 one patch.
34 OPTIONS
35 -------
36 -o|--output-directory <dir>::
37 Use <dir> to store the resulting files, instead of the
38 current working directory.
40 -n|--numbered::
41 Name output in '[PATCH n/m]' format.
43 -k|--keep-subject::
44 Do not strip/add '[PATCH]' from the first line of the
45 commit log message.
47 -s|--signoff::
48 Add `Signed-off-by:` line to the commit message, using
49 the committer identity of yourself.
51 -c|--check::
52 Display suspicious lines in the patch. The definition
53 of 'suspicious lines' is currently the lines that has
54 trailing whitespaces, and the lines whose indentation
55 has a SP character immediately followed by a TAB
56 character.
58 --stdout::
59 This flag generates the mbox formatted output to the
60 standard output, instead of saving them into a file per
61 patch and implies --mbox.
63 --attach::
64 Create attachments instead of inlining patches.
67 CONFIGURATION
68 -------------
69 You can specify extra mail header lines to be added to each
70 message in the repository configuration as follows:
72 [format]
73 headers = "Organization: git-foo\n"
76 EXAMPLES
77 --------
79 git-format-patch -k --stdout R1..R2 | git-am -3 -k::
80 Extract commits between revisions R1 and R2, and apply
81 them on top of the current branch using `git-am` to
82 cherry-pick them.
84 git-format-patch origin::
85 Extract commits the current branch accumulated since it
86 pulled from origin the last time in a patch form for
87 e-mail submission.
89 git-format-patch -M -B origin::
90 The same as the previous one, except detect and handle
91 renames and complete rewrites intelligently to produce
92 renaming patch. A renaming patch reduces the amount of
93 text output, and generally makes it easier to review
94 it. Note that the "patch" program does not understand
95 renaming patch well, so use it only when you know the
96 recipient uses git to apply your patch.
99 See Also
100 --------
101 gitlink:git-am[1], gitlink:git-send-email[1]
104 Author
105 ------
106 Written by Junio C Hamano <junkio@cox.net>
108 Documentation
109 --------------
110 Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
112 GIT
113 ---
114 Part of the gitlink:git[7] suite