git am
git
Usage
git am [-3] <mbox|patch>...Turns mailed patches into commits, keeping the original author and message; on failure it stops in the middle of the series, so you have to finish with --continue, --skip or --abort.
Common flags
| Flag | Meaning |
|---|---|
| -3 | three-way merge when the patch does not apply cleanly |
| -s | add a Signed-off-by line |
| --continue | go on after you fixed the conflict |
| --skip | drop this patch and continue the series |
| --abort | undo the whole series |
| -k | keep the subject line exactly as it is |
Examples
git am 0001-fix-login.patchcommits the patch, keeping its original author
git am -3 *.patchapplies a whole series, merging where needed
git am --abortreturns to before the series started
The confusion is that undo has several shapes — moving where a branch points is not the same as adding a commit that reverses it.
How to read this
- Square brackets [ ] mark a part you may leave out.
- An ellipsis … means you can list more than one.
- Flags are case-sensitive — in some commands -r and -R do different things.
Questions
Q. What does git am do?
Turns mailed patches into commits, keeping the original author and message; on failure it stops in the middle of the series, so you have to finish with --continue, --skip or --abort.
Q. How do I type it?
git am [-3] <mbox|patch>... — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
6 are listed here; the full set is in man git. This command sits under git.
Related commands
man page: man git-am