]>
Commit | Line | Data |
---|---|---|
42e2cba2 | 1 | git-am(1) |
05625af3 | 2 | ========= |
42e2cba2 PB |
3 | |
4 | NAME | |
5 | ---- | |
c3f0baac | 6 | git-am - Apply a series of patches from a mailbox |
42e2cba2 PB |
7 | |
8 | ||
9 | SYNOPSIS | |
10 | -------- | |
353ce815 | 11 | [verse] |
b1889c36 | 12 | 'git am' [--signoff] [--keep] [--utf8 | --no-utf8] |
a79ec62d NS |
13 | [--3way] [--interactive] [--committer-date-is-author-date] |
14 | [--ignore-date] | |
b47dfe9e | 15 | [--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>] |
0e987a12 | 16 | [--reject] [-q | --quiet] |
356a32a2 | 17 | [<mbox> | <Maildir>...] |
3e5057a8 | 18 | 'git am' (--skip | --resolved | --abort) |
42e2cba2 PB |
19 | |
20 | DESCRIPTION | |
21 | ----------- | |
22 | Splits mail messages in a mailbox into commit log message, | |
23 | authorship information and patches, and applies them to the | |
24 | current branch. | |
25 | ||
baa720f5 JH |
26 | OPTIONS |
27 | ------- | |
d63bd9a2 | 28 | <mbox>|<Maildir>...:: |
d4144612 | 29 | The list of mailbox files to read patches from. If you do not |
07f5746f DM |
30 | supply this argument, the command reads from the standard input. |
31 | If you supply directories, they will be treated as Maildirs. | |
d4144612 | 32 | |
3240240f SB |
33 | -s:: |
34 | --signoff:: | |
3db964b5 | 35 | Add a `Signed-off-by:` line to the commit message, using |
baa720f5 | 36 | the committer identity of yourself. |
42e2cba2 | 37 | |
3240240f SB |
38 | -k:: |
39 | --keep:: | |
ba020ef5 | 40 | Pass `-k` flag to 'git-mailinfo' (see linkgit:git-mailinfo[1]). |
d84029b6 | 41 | |
0e987a12 SB |
42 | -q:: |
43 | --quiet:: | |
44 | Be quiet. Only print error messages. | |
45 | ||
3240240f SB |
46 | -u:: |
47 | --utf8:: | |
ba020ef5 | 48 | Pass `-u` flag to 'git-mailinfo' (see linkgit:git-mailinfo[1]). |
d84029b6 | 49 | The proposed commit log message taken from the e-mail |
870e0d61 | 50 | is re-coded into UTF-8 encoding (configuration variable |
d84029b6 JH |
51 | `i18n.commitencoding` can be used to specify project's |
52 | preferred encoding if it is not UTF-8). | |
53 | + | |
54 | This was optional in prior versions of git, but now it is the | |
07f5746f | 55 | default. You can use `--no-utf8` to override this. |
d84029b6 JH |
56 | |
57 | --no-utf8:: | |
ba020ef5 | 58 | Pass `-n` flag to 'git-mailinfo' (see |
5162e697 | 59 | linkgit:git-mailinfo[1]). |
baa720f5 | 60 | |
3240240f SB |
61 | -3:: |
62 | --3way:: | |
baa720f5 | 63 | When the patch does not apply cleanly, fall back on |
07f5746f DM |
64 | 3-way merge if the patch records the identity of blobs |
65 | it is supposed to apply to and we have those blobs | |
870e0d61 | 66 | available locally. |
baa720f5 | 67 | |
8273c79a | 68 | --whitespace=<option>:: |
3240240f SB |
69 | -C<n>:: |
70 | -p<n>:: | |
b47dfe9e | 71 | --directory=<dir>:: |
b80da424 | 72 | --reject:: |
ba020ef5 | 73 | These flags are passed to the 'git-apply' (see linkgit:git-apply[1]) |
870e0d61 | 74 | program that applies |
67dad687 MT |
75 | the patch. |
76 | ||
3240240f SB |
77 | -i:: |
78 | --interactive:: | |
870e0d61 FL |
79 | Run interactively. |
80 | ||
a79ec62d NS |
81 | --committer-date-is-author-date:: |
82 | By default the command records the date from the e-mail | |
83 | message as the commit author date, and uses the time of | |
84 | commit creation as the committer date. This allows the | |
85 | user to lie about the committer date by using the same | |
e77063fc | 86 | value as the author date. |
a79ec62d NS |
87 | |
88 | --ignore-date:: | |
89 | By default the command records the date from the e-mail | |
90 | message as the commit author date, and uses the time of | |
91 | commit creation as the committer date. This allows the | |
e77063fc SB |
92 | user to lie about the author date by using the same |
93 | value as the committer date. | |
a79ec62d | 94 | |
870e0d61 FL |
95 | --skip:: |
96 | Skip the current patch. This is only meaningful when | |
97 | restarting an aborted patch. | |
baa720f5 | 98 | |
3240240f SB |
99 | -r:: |
100 | --resolved:: | |
087b6742 JH |
101 | After a patch failure (e.g. attempting to apply |
102 | conflicting patch), the user has applied it by hand and | |
103 | the index file stores the result of the application. | |
104 | Make a commit using the authorship and commit log | |
105 | extracted from the e-mail message and the current index | |
106 | file, and continue. | |
baa720f5 | 107 | |
5c19f244 AR |
108 | --resolvemsg=<msg>:: |
109 | When a patch failure occurs, <msg> will be printed | |
110 | to the screen before exiting. This overrides the | |
111 | standard message informing you to use `--resolved` | |
112 | or `--skip` to handle the failure. This is solely | |
ba020ef5 | 113 | for internal use between 'git-rebase' and 'git-am'. |
5c19f244 | 114 | |
3e5057a8 NS |
115 | --abort:: |
116 | Restore the original branch and abort the patching operation. | |
117 | ||
baa720f5 JH |
118 | DISCUSSION |
119 | ---------- | |
120 | ||
2499857b | 121 | The commit author name is taken from the "From: " line of the |
e77063fc | 122 | message, and commit author date is taken from the "Date: " line |
2499857b JH |
123 | of the message. The "Subject: " line is used as the title of |
124 | the commit, after stripping common prefix "[PATCH <anything>]". | |
3db964b5 SB |
125 | The "Subject: " line is supposed to concisely describe what the |
126 | commit is about in one line of text. | |
2499857b | 127 | |
7713e053 SB |
128 | "From: " and "Subject: " lines starting the body (the rest of the |
129 | message after the blank line terminating the RFC2822 headers) | |
130 | override the respective commit author name and title values taken | |
131 | from the headers. | |
2499857b JH |
132 | |
133 | The commit message is formed by the title taken from the | |
134 | "Subject: ", a blank line and the body of the message up to | |
3db964b5 SB |
135 | where the patch begins. Excess whitespace at the end of each |
136 | line is automatically stripped. | |
2499857b JH |
137 | |
138 | The patch is expected to be inline, directly following the | |
07f5746f | 139 | message. Any line that is of the form: |
2499857b JH |
140 | |
141 | * three-dashes and end-of-line, or | |
142 | * a line that begins with "diff -", or | |
143 | * a line that begins with "Index: " | |
144 | ||
145 | is taken as the beginning of a patch, and the commit log message | |
146 | is terminated before the first occurrence of such a line. | |
147 | ||
3db964b5 | 148 | When initially invoking `git am`, you give it the names of the mailboxes |
07f5746f DM |
149 | to process. Upon seeing the first patch that does not apply, it |
150 | aborts in the middle. You can recover from this in one of two ways: | |
baa720f5 | 151 | |
07f5746f | 152 | . skip the current patch by re-running the command with the '--skip' |
baa720f5 JH |
153 | option. |
154 | ||
087b6742 | 155 | . hand resolve the conflict in the working directory, and update |
07f5746f DM |
156 | the index file to bring it into a state that the patch should |
157 | have produced. Then run the command with the '--resolved' option. | |
baa720f5 | 158 | |
07f5746f | 159 | The command refuses to process new mailboxes while the `.git/rebase-apply` |
baa720f5 | 160 | directory exists, so if you decide to start over from scratch, |
51ef1daa | 161 | run `rm -f -r .git/rebase-apply` before running the command with mailbox |
baa720f5 | 162 | names. |
42e2cba2 | 163 | |
9869099b BG |
164 | Before any patches are applied, ORIG_HEAD is set to the tip of the |
165 | current branch. This is useful if you have problems with multiple | |
166 | commits, like running 'git am' on the wrong branch or an error in the | |
167 | commits that is more easily fixed by changing the mailbox (e.g. | |
168 | errors in the "From:" lines). | |
169 | ||
42e2cba2 PB |
170 | |
171 | SEE ALSO | |
172 | -------- | |
5162e697 | 173 | linkgit:git-apply[1]. |
42e2cba2 PB |
174 | |
175 | ||
176 | Author | |
177 | ------ | |
59eb68aa | 178 | Written by Junio C Hamano <gitster@pobox.com> |
42e2cba2 PB |
179 | |
180 | Documentation | |
181 | -------------- | |
182 | Documentation by Petr Baudis, Junio C Hamano and the git-list <git@vger.kernel.org>. | |
183 | ||
42e2cba2 PB |
184 | GIT |
185 | --- | |
9e1f0a85 | 186 | Part of the linkgit:git[1] suite |