Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single stats for the same author with multiple username and/or email #156

Open
javaDeveloperKid opened this issue Jan 7, 2024 · 2 comments

Comments

@javaDeveloperKid
Copy link

javaDeveloperKid commented Jan 7, 2024

Is your feature request related to a problem? Please describe.
I often work with repositories where single user creates commits with different username and/or email. This can happen for different reasons: git is configured differently on a computer in a workplace and on a computer at home; commits are from Web UI where a user has different name/email; user changed an email after some time;

Describe the solution you'd like
I would like to somehow tell git-quick-stats to consider given author keywords as the same author.
Example:
John Kravecki john.kravecki@job.com
johnk johnk@gmail.com
Then I tell git-quisk-stats that any of [user: John Kravecki, email: john.kravecki@job.com, user:johnk, email:johnk@gmail.com] is the same author.

Describe alternatives you've considered
Another solution would be to have an option to merge results into one.
Example:
I have the same user with multiple username and/or email but I know that every time there is the same pattern, e.g. a surname kravecki. Then I can use _GIT_LOG_OPTIONS="--author=kravecki but I need another option, e.g. --same-author or --merge-author to get stats like it was a single user.

Additional context
None

@MuhammadSulaiman001
Copy link

This could be solved using git .mailmap, here is an example:

  1. Create .mailmap file at the root of the project,
  2. Here is an example content to write in .mailmap file:
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>

Explanation: the first line tells git that this name has this e-mail, second line tells git that there is another alias for this (name-email pair).. and so on.

This way, git will use Muhammad Sulaiman <muhammad.b.sulaiman001@gmail.com> whenever it sees m.sulaiman001@gmail.com..

Now run git-quick-stats again, issue solved.

I've documented the steps in the following gist long time ago, refer to it for detailed description.

@javaDeveloperKid
Copy link
Author

@MuhammadSulaiman001 thank you for your answer. Will check that out asap. However what about same email and different name? E.g.:

Muhammad Sulaiman <muhammad.b.sulaiman001@gmail.com>
msulaiman <muhammad.b.sulaiman001@gmail.com>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants