简体   繁体   English

“Alias”git作者/提交者?

[英]“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> . 所以我设法承诺了一个domenic <domenic@domenicdenicola.com>项目,如domenic <domenic@domenicdenicola.com>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. 而且我担心GitHub甚至可能最终将“Domenic Denicola 5分钟前提交的内容”附加到项目中的每一个提交中。 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." 我希望有一些方法可以告诉Git,“这两个作者/提交者是完全一样的人;算这样做。” Is there? 在那儿?

Set up a .mailmap file in your repo. 在您的.mailmap设置.mailmap文件。 See git help shortlog for details, or check out the one for Git itself . 有关详细信息,请参阅git help shortlog ,或查看Git本身的内容

See Mapping authors section: https://git-scm.com/docs/git-shortlog#_mapping_authors 请参阅Mapping authors部分: 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 . 如果您提交的电子邮件与您帐户关联的电子邮件不同,则可以通过https://github.com/settings/emails添加其他电子邮件。

I had this problem when using Source Tree to commit to GitHub. 使用Source Tree提交GitHub时出现此问题。 It submits using the name: pcuser@pcFQDN, which is not my email address. 它使用名称:pcuser @ pcFQDN提交,这不是我的电子邮件地址。 Adding this false address to my GitHub account made all of my commits show as me. 将此虚假地址添加到我的GitHub帐户使我的所有提交显示为我。 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? git shortlog -s -e唯一的问题吗?

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? 至于GitHub部分,也许您应该尝试使用git filter-branch --env-filter重写历史记录( 请参阅另一个问题 ),将其推送到新的存储库并查看它的外观?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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