简体   繁体   中英

“Alias” git authors/committers?

So I've managed to commit to a GitHub project as both domenic <domenic@domenicdenicola.com> and Domenic Denicola <domenic@domenicdenicola.com> . This is annoying, especially for generating summaries.

I know about how to change the authors/committers retroactively . However, this has lots of undesirable consequences for a project that is already pushed and public, eg changing all the hashes (and thus invalidating links to them people have made, or comments on them); losing the tags; and I'm afraid GitHub might even end up appending "committed 5 minutes ago by Domenic Denicola" to every single commit in the project. So that's not an option.

I was hoping there was some way to tell Git, "these two authors/committers are exactly the same person; count them as such." Is there?

Set up a .mailmap file in your repo. See git help shortlog for details, or check out the one for Git itself .

See Mapping authors section: https://git-scm.com/docs/git-shortlog#_mapping_authors

If your email used to submit is different than the email associated with your account, you can add the additional email at https://github.com/settings/emails .

I had this problem when using Source Tree to commit to GitHub. It submits using the name: pcuser@pcFQDN, which is not my email address. Adding this false address to my GitHub account made all of my commits show as me. It does not require that the address be verified.

As far as I know, there is currently no way to add such name aliases. Could you elaborate a bit on the problems you are seeing with two different realnames? Is git shortlog -s -e the only issue?

As for the GitHub part, perhaps you should try rewriting the history with git filter-branch --env-filter ( see another question ), push it to a new repository and see how it looks?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM