# info > GIT-MAILINFO

---
type: CommandReference
command: git-mailinfo
mode: man
section: 1
source: man-pages
---

## Quick Reference
- `git mailinfo msg patch < email` — Extract patch and message from an email
- `git mailinfo -k msg patch < email` — Keep Subject line as-is (no cruft removal)
- `git mailinfo --scissors msg patch < email` — Discard message body before the scissors line
- `git mailinfo -u msg patch < email` — Re‑encode metadata to UTF‑8 (default)
- `git mailinfo -n msg patch < email` — Disable charset re‑coding of metadata
- `git mailinfo --message-id msg patch < email` — Append Message‑ID to commit message

## Name
git-mailinfo — Extracts patch and authorship from a single e‑mail message

## Synopsis
shell
git mailinfo [-k|-b] [-u | --encoding=<encoding> | -n]
             [--[no-]scissors] [--quoted-cr=<action>]
             <msg> <patch>
## Description
Reads one e‑mail from standard input and writes the commit log message to `<msg>` and the patch to `<patch>`. Author name, email, and subject are printed to standard output for consumption by `git am`. Usually invoked indirectly; see [git-am(1)](http://localhost/phpMan.php/man/git-am/1/markdown).

## Options

### Subject cleaning
- `-k` — Keep the Subject header untouched. Normally, `Re:`, `[PATCH]`, and leading/trailing whitespace are removed, and runs of whitespace collapse to a single space.
- `-b` — When `-k` is not used, strip only `[`…`]` pairs that contain the word “PATCH” (instead of all bracketed strings).

### Charset handling
- `-u` — Re‑encode commit metadata (author, subject) to the encoding specified by `i18n.commitEncoding` (default UTF‑8). The patch itself is never converted.
- `--encoding=<encoding>` — Same as `-u`, but re‑encode to the given charset.
- `-n` — Disable all charset re‑coding of metadata.

### Message manipulation
- `-m`, `--message-id` — Append the `Message-ID` header to the commit message.
- `--scissors` — Remove everything in the body before a scissors line (e.g., `-- >8 --`). The line itself is also removed. Enabled by default if `mailinfo.scissors` is set.
- `--no-scissors` — Ignore scissors lines, overriding `mailinfo.scissors`.

### Line endings
- `--quoted-cr=<action>` — Handle decoded lines that end with CRLF (from base64 or quoted‑printable). `<action>` can be `nowarn` (silent), `warn` (default, if no config), or `strip` (convert to LF). The default is configurable via `mailinfo.quotedCR`.

### Positional arguments
- `<msg>` — File to write the commit log message (usually without the subject line).
- `<patch>` — File to write the patch.

## Examples
shell
# Basic usage: pipe an email to git mailinfo
git mailinfo msg.txt patch.txt < email.eml

# Keep the original Subject line (e.g., for git-format-patch -k output)
git mailinfo -k msg.txt patch.txt < email.eml

# Strip everything before the scissors line
git mailinfo --scissors msg.txt patch.txt < email.eml

# Append the Message-ID to the commit message
git mailinfo --message-id msg.txt patch.txt < email.eml
## See Also
- [git(1)](http://localhost/phpMan.php/man/git/1/markdown)
- [git-am(1)](http://localhost/phpMan.php/man/git-am/1/markdown)