Skip to content

check-mailmap Git Command Guide

The git check-mailmap command is used to show canonical names and email addresses of contacts by looking up the person’s proper name and email address from .mailmap entries. If the canonical information is found, it’s printed; otherwise the input is shown as-is.

Terminal window
git check-mailmap [<options>] <contact>...
OptionDescription
—stdinRead contacts, one per line, from the standard input after exhausting contacts provided on the command-line
—mailmap-file=In addition to any configured mailmap files, read the specified mailmap file
—mailmap-blob=Like —mailmap-file, but consider the value as a reference to a blob in the repository
ParameterDescription
Contact information in formats like “Name user@host”, “user@host”, or “user@host”
Terminal window
git check-mailmap "John Doe <john@example.com>"

Looks up the canonical form of the given contact.

Terminal window
git check-mailmap user@domain.com "Jane Smith <jane@test.org>"

Processes multiple contacts and shows their canonical forms.

Terminal window
echo "alias@example.com" | git check-mailmap --stdin

Reads contact from standard input.

Terminal window
git check-mailmap --mailmap-file=.mailmap new@example.com

Uses a specific mailmap file for lookups.

Terminal window
git check-mailmap --mailmap-blob=HEAD:.mailmap dev@company.com

Uses a blob in the repository as the mailmap source.

How do I check the canonical form of an email address?

Section titled “How do I check the canonical form of an email address?”

To check the canonical form of an email address, use:

Terminal window
git check-mailmap <email>

To check multiple contacts, run:

Terminal window
git check-mailmap <contact1> <contact2>...

How do I use stdin with git check-mailmap?

Section titled “How do I use stdin with git check-mailmap?”

To use stdin with git check-mailmap, execute:

Terminal window
echo "<contact>" | git check-mailmap --stdin

To specify a custom mailmap file, use:

Terminal window
git check-mailmap --mailmap-file=<file> <contact>

To use a blob as mailmap source, run:

Terminal window
git check-mailmap --mailmap-blob=<ref>:<path> <contact>

Applications of the git check-mailmap command

Section titled “Applications of the git check-mailmap command”
  1. Verifying .mailmap configurations for accurate contributor identification
  2. Standardizing author and committer names in commit history analysis
  3. Checking canonical contact information before commiting changes to .mailmap
  4. Debugging mailmap rules during repository maintenance
  5. Validating email address mappings for proper attribution in git stats
  6. Testing mailmap transformations before global implementation
  7. Resolving contributor identity inconsistencies across different Git operations