Progress:
TIER 2 · MODULE 42· Intermediate

git check-mailmap

Apply .mailmap to a name to see the canonical form.

🎯 What & why

Applies your repository's .mailmap to a name/email and prints the canonical form. Lets you confirm that 'jdoe <jd@old.com>' really is being collapsed into 'Jane Doe <jane@new.org>' before shortlog or blame surprise you.

🧠 Mental model

Plumbing wrapper around the same lookup that log/shortlog/blame use when mailmap is in effect. .mailmap is a flat text file in the repo root (or wherever mailmap.file points) mapping commit identities to canonical ones; check-mailmap is just 'run that mapping and show me the result'.

🛠️ Synopsis

git check-mailmap [<options>] <contact>...

Each <contact> is either 'Name <email>' or '<email>'. With --stdin,
read one contact per line from standard input. Output is the canonical
form, one per input, in order. Useful for sanity-checking .mailmap
edits without running a full shortlog.

🎚️ Switches & options

FlagWhat it does
--stdinRead contacts from stdin, one per line. Pipe git log --pretty=format:'%an <%ae>' into it to see how every author would be rewritten.

💡 Use cases

🧪 Examples

Single lookup
git check-mailmap 'Jane D <jd@old.example>'
Email-only form
git check-mailmap '<jd@old.example>'
Audit every author
git log --pretty=format:'%an <%ae>' | sort -u | git check-mailmap --stdin
Spot identities with no mapping
git log --pretty='%an <%ae>' | sort -u | git check-mailmap --stdin | sort -u

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

Hit each option, then Check answers. Score is recorded; Next is always open.