git-quick-stats
git-quick-stats copied to clipboard
Single stats for the same author with multiple username and/or email
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 [email protected]
johnk [email protected]
Then I tell git-quisk-stats that any of [user: John Kravecki, email: [email protected], user:johnk, email:[email protected]] 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
This could be solved using git .mailmap, here is an example:
- Create
.mailmapfile at the root of the project, - Here is an example content to write in
.mailmapfile:
Muhammad Sulaiman <[email protected]>
Muhammad Sulaiman <[email protected]> <[email protected]>
Friend Name <[email protected]>
Friend Name <[email protected]> <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 <[email protected]> whenever it sees [email protected]..
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.
@MuhammadSulaiman001 thank you for your answer. Will check that out asap. However what about same email and different name? E.g.:
Muhammad Sulaiman <[email protected]>
msulaiman <[email protected]>