git-mailsplit
Split mbox or maildir format into files
SYNOPSIS
git mailsplit [-b] [-t<dir>] [--keep-cr] [-d<prec>] [--] <mbox>
PARAMETERS
-b
Compress each output file with bzip2, appending .bz2 to filenames.
-t<dir>
Output files to directory <dir> instead of current directory.
--keep-cr
Preserve carriage return characters (&cr;) in input lines.
-d<prec>
Zero-pad filenames to exactly <prec> digits (default: 4)
DESCRIPTION
git mailsplit is a utility in the Git suite that splits a single mbox file containing multiple email messages into separate files, one per message. This is essential for workflows involving mailing list archives, such as applying patches extracted from public inboxes using git am.
The command parses the input mbox, identifies message boundaries using standard mbox conventions (like 'From ' lines), and writes each message to a numbered file with zero-padded names (e.g., 0000, 0001). By default, files are created in the current directory, which can lead to overwrites.
It supports options for output directory, compression, padding precision, and handling of carriage returns. Primarily used in Git's email-based patch application process, it ensures clean separation for subsequent commands like git am *.msg or scripting batch applies.
Handles large archives efficiently, making it a go-to tool for developers processing Linux kernel mailing lists or similar.
CAVEATS
Outputs to current directory by default, silently overwriting files like 0000, 0001. Specify -t<dir> for safety. Assumes standard mbox format; may fail on corrupted or non-standard input.
TYPICAL USAGE
git mailsplit -t tmp/ archive.mbox
git am tmp/00*
FILENAMES
Sequential zero-padded names: 0000, 0001, etc., based on message count and precision.
HISTORY
Introduced early in Git development around 2005-2006 as part of the email patch workflow tools. Evolved with Git releases; stable since v1.5.0 (2007). Remains unchanged in core functionality across modern Git versions.
SEE ALSO
git-am(1), formail(1), munpack(1)


