Pre-step for git am on a big mailbox.
Splits a single mbox file (or a stream of concatenated emails) into one file per message, numbered 0001, 0002, etc. The git am workflow's first stage when feeding a big mailbox.
Input: an mbox. Output: a directory of single-message files with zero-padded sequence numbers. That's it - no parsing, no patch extraction; that's mailinfo's job.
git mailsplit -o<dir> [-b] [-d<prec>] [-f<nr>] [--keep-cr] [--mboxrd]
[<mbox>|<dir>...]
# Typical use: explode a downloaded mbox
git mailsplit -o./patches inbox.mbox
# Result:
./patches/0001
./patches/0002
./patches/0003
...| Flag | What it does |
|---|---|
-o<dir> | Output directory (must exist); files are written here |
-b | Treat any file that isn't an mbox as a single bare email |
-d<n> | Use n-digit zero-padded numbers (default 4: 0001) |
-f<n> | Start numbering at n instead of 1 |
--keep-cr | Preserve CRLF line endings instead of normalizing to LF |
--mboxrd | Parse as mboxrd format (handles >From un-escaping correctly) |
git mailsplit -o./p mbox && git am ./p/*.-f5..eml files into a uniformly numbered set.--keep-cr).mkdir patches && git mailsplit -o./patches inbox.mboxgit mailsplit -o./p -d3 -f10 inbox.mbox # 010, 011, ...git mailsplit -b -o./p single.emlgit am ./patches/*mailsplit doesn't mkdir -p.--mboxrd if your mbox came from a tool that escapes >From ; otherwise messages can be silently truncated.git am --keep-cr if you used --keep-cr here, for symmetric handling.From lines, which can break inside quoted text - --mboxrd is safer.*.eml won't match.Hit each option, then Check answers. Score is recorded; Next is always open.