2

I use git, and have entries in mailmap that remaps the various email-addresses people use to the "canonical" name and email for that user. However, I also have some historical commits in which there's no email at all, but merely a username, such as "tommy".

I want to remap these too, to the canonical name and email for that user, but have been unable to do so. I've tried both:

Canonical_name tommy
Canonical <canonical@email> tommy <>
Canonical tommy <>

but none of these seem to have any effect at all.

Edit to clarify: I don't have any wish of changing the history. I just want the canonical names displayed when prettyprinting with %aN which remaps names using mailmap. This works -perfect- for the case where 3 different email-adresses are supposed to map to one canonical name. But not at all for the case where the original comitter didn't supply an email-address at all.

Agrajag
  • 1,016
  • 2
  • 9
  • 24
  • What version are you using? From the Git release notes for version 1.6.2: `The location of .mailmap file can be configured, and its file format was enhanced to allow mapping an incorrect e-mail field as well.` A quick test using version 1.7.8 works correctly; the author info is mapped when I use `Tommy Lee tommy <>` in `.mailmap`. This might be a behavioral difference between versions. – Go Dan Dec 19 '11 at 14:29

3 Answers3

1

The second line of syntax attempted by the OP works on my machine (git version 2.33.1):

Canonical <canonical@email> tommy <>

Perhaps this was a feature added to git in the decade since the question was originally asked.

eeowaa
  • 431
  • 3
  • 15
0

As commits are already in the tree, they will not change -- it would break the history's integrity!

Your only option, if you really want to do that, is to use git filter-branch, see here for more details. But you will definitely alter your repository, which means other people using this same repository as a base will also be affected.

Community
  • 1
  • 1
fge
  • 119,121
  • 33
  • 254
  • 329
0

You could add a fake e-mail address like none@mycompany.com.

On the other hand: if the people are still in the project, they will have an existing E-Mail address now. If they are no longer there: why bother with the address? You could take a fake address in that case...

eckes
  • 64,417
  • 29
  • 168
  • 201