Skip to content

Instantly share code, notes, and snippets.

@MuhammadSulaiman001
Last active April 26, 2024 19:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MuhammadSulaiman001/0005f9e01e46880f59150eaef29a3358 to your computer and use it in GitHub Desktop.
Save MuhammadSulaiman001/0005f9e01e46880f59150eaef29a3358 to your computer and use it in GitHub Desktop.

git .mailmap file

Steps

  1. Use this good git alias
git config --global alias.summary '! git shortlog --summary --numbered --email --all --no-merges'
  1. Run git summary at the root of the repo, you'll get something like
517  Muhammad Sulaiman <muhammad.b.sulaiman001@gmail.com>
514  Muhammad <m.sulaiman001@gmail.com>
468  My Friend <90533@LAPTOP-ABV>
8  Friend Name <hi@there.com>
  1. Create .mailmap file at repo root, first line tells git that this name has this e-mail, second line tells git that there is another alias for this name-email, that uses this second email.. and so on
Muhammad Sulaiman <muhammad.b.sulaiman001@gmail.com>
Muhammad Sulaiman <muhammad.b.sulaiman001@gmail.com> <m.sulaiman001@gmail.com>
Friend Name <hi@there.com>
Friend Name <hi@there.com> <90533@LAPTOP-ABV>
  1. Run git summary again, you'll get something like
1031  Muhammad Sulaiman <muhammad.b.sulaiman001@gmail.com>
476  Friend Name <hi@there.com>

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment