When someone committed with three different email addresses over the years, git shortlog -sn counts them as three people. A .mailmap file in the repository fixes the output without rewriting any history.
Alice <[email protected]> <[email protected]>
Alice <[email protected]> al <[email protected]>
Each line maps an identity as it appears in commits, on the right, to the identity you want to see, on the left. The first line maps an old email; the second maps a name and email combination. Save it as .mailmap at the root and commit it.
Then the counts come out right:
git shortlog -sne HEAD
git log uses the mailmap too, but only in some fields. In a custom format, %aN and %aE give the mapped name and email, while %an and %ae still show what’s in the commit. I think that is easy to miss, and the docs spell it out.
The commits themselves don’t change. The old address is still in the history for anyone who looks at the raw commit, so a mailmap is not a way to hide an address. It only cleans up the display. If you want to stop leaking an address, change user.email for future commits, and accept that the old ones stay unless you rewrite history.
Further reading: gitmailmap documentation, git-shortlog documentation