The “git-mailinfo” command is a utility used internally by Git’s “git-am” command to extract patch and authorship information from a single email message.
When you run the “git-mailinfo” command, you typically provide it with an email message as input. It reads the email message and extracts the patch information, including the diff content and authorship details.
The “git-mailinfo” command is designed to work with email messages that are formatted according to Git’s email patch format conventions. It parses the email headers, such as “From:”, “Subject:”, and “Date:”, as well as the body of the message to extract the necessary information for applying the patch.
The extracted patch information can then be used by other Git commands, such as “git-am”, to apply the patch to your repository.
git mailinfo Command Examples
1. Extract the patch and author data from an email message:
# git mailinfo [message|patch]
2. Extract but remove leading and trailing whitespace:
# git mailinfo -k [message|patch]
3. Remove everything from the body before a scissors line (e.g. “–>* –“) and retrieve the message or patch:
# git mailinfo --scissors [message|patch]