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