1001Ferramentas
📧 Dev

.mailmap (Git) Generator

Map inconsistent names and emails to a single author in Git, improving stats and shortlog. Official format.

.mailmap:

.mailmap: one person, several emails, a single name

Anyone contributing for years accumulates identities: the personal email from the early days, the corporate one later, the domainless GitHub address, the name spelled three different ways. In repository statistics that becomes one person counted four times, each holding a slice of the commits. The .mailmap fixes it in the presentation, without touching a single commit.

Paste the mappings and the page validates each line and normalises the spacing. Four forms are accepted, all running from what you want shown to what is recorded in the commit: name only; email only; name and email corrected from the old email; and the full form, which matches old name and email at the same time. A malformed line is flagged with the reason rather than slipping through.

It matters to know where the file acts and where it does not. It is read by git shortlog, git log, git blame and by statistics tools — presentation changes. The commit objects keep their original data, and hashes do not change. Save it as .mailmap in the root and commit it: unlike the blame configuration, this file travels with the repository and applies to everyone automatically.

Frequently asked questions

Why did Git ignore my line?
Almost always formatting: an email without angle brackets, leftover text outside them, or a space inside the address. Git does not complain — it simply ignores the line, and you find out from the result that did not change. It is exactly that silence this page's validation covers.
What order do the parts go in?
Always from the correct identity to the old one: first the name and email that should appear, then what is recorded in the commit. Reversing them is the most common mistake, and the effect is the opposite of what you wanted — correct commits start showing under the old identity.
Does it work on GitHub?
The contribution count on a profile does not use .mailmap; it goes by the email associated with the account. The file affects what Git shows locally and what repository analysis tools compute. To consolidate contributions on a profile, the route is adding the old emails to the account.

Related Tools