git am (apply mailbox)¶
git am is a Git command used to apply a series of patches from a mailbox file to the current branch^[600-developer__tools__git__git-patch-cherry-pick.md]. Unlike simple patching commands, git am applies commits while preserving their original commit metadata, such as the commit message and author information^[600-developer__tools__git__git-patch-cherry-pick.md].
Overview¶
The command name stands for "apply mailbox," referring to the standard format for storing email messages that contain patches^[600-developer__tools__git__git-patch-cherry-pick.md]. It is typically used to apply patches generated by git format-patch^[600-developer__tools__git__git-patch-cherry-pick.md].
Usage¶
The basic syntax to apply a patch file using standard input is:
git am -s < 0001-minor-fix.patch
The -s flag is commonly used to add a 'Signed-off-by' line to the commit message^[600-developer__tools__git__git-patch-cherry-pick.md].
Related Concepts¶
- git format-patch
- [[git apply]]
- [[Patch workflow]]
- [[Cherry-pick]]
Sources¶
- 600-developer__tools__git__git-patch-cherry-pick.md