Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Alias" git authors/committers?

Tags:

git

github

So I've managed to commit to a GitHub project as both domenic <[email protected]> and Domenic Denicola <[email protected]>. 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, e.g. 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?

like image 743
Domenic Avatar asked May 17 '12 14:05

Domenic


People also ask

What is a git alias?

Git aliases are a powerful workflow tool that create shortcuts to frequently used Git commands. Using Git aliases will make you a faster and more efficient developer. Aliases can be used to wrap a sequence of Git commands into new faux Git command.

What is author name in git?

Git store the name and the email of two persons for each commit: the committer and the author. The difference between the two is that the author is the person who wrote the changes, while the committer is the person who uploaded them the repository.

How do I change the author and committer name and email of multiple commits in git?

The git commit --amend --reset-author --no-edit command is especially useful if you created commits with the wrong author information, then set the correct author after-the-fact via git config .


2 Answers

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

like image 162
Fred Foo Avatar answered Oct 08 '22 03:10

Fred Foo


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.

like image 38
Tim Avatar answered Oct 08 '22 04:10

Tim