Git Mailmap#
I’m playing with Gource to create nice animations for projects I have worked on in the past.
To protect other developer’s privacy, I need to restrict Gource to myself by
using --user-show-filter Felix
.
I was surprised when multiple avatars appeared before my eyes, even though the filter above should only return a single user. Then I remembered: I might have used different email addresses or user names during the development of this project, and surely here they are:
$ git shortlog --summary --numbered --email | rg -i felix
2223 Felix Hummel <felix@felixhummel.de>
64 Felix <felix@felixhummel.de>
10 Felix Hummel <felix.hummel@example.com>
Fortunately, git supports a .mailmap that exists for the express purpose of cleaning up this kind of mess.
What you want to keep comes first. That’s
Felix Hummel <felix@felixhummel.de>
for me.This also maps the first name to the full name (via the shared mail address).
The mapping from
example.com
to my primary email address comes last.
Given the above, we arrive at the following:
Felix Hummel <felix@felixhummel.de>
Felix Hummel <felix@felixhummel.de> <felix.hummel@example.com>
And that’s it! :)