有一种方法来覆盖本地存储库配置中的git作者的显示名称? [英] Is there a way to override a git author's display name in local repository config?
问题描述
我有一个从subversion导入的git仓库,用户名为 H1234567
。当我运行 git log
或 git blame
我更喜欢看到 dave
H1234567
。
可以在config中覆盖特定作者的名称,显示自定义名称?或者也许有一种方法来实现这与gettext?
您可以使用mailmap文件执行此操作,可以在不修改历史记录的情况下翻译作者姓名和电子邮件。 / p>
在存储库根目录中创建一个文件 .mailmap
,具有以下内容:
dave< dave@example.com> H1234567< H1234567@original.com>
您可以设置不同的电子邮件地址,或保留原来的电子邮件地址。
请参阅文档/ mailmap.txt 更多。
I have a git repository imported from subversion where users have names like H1234567
. When I run git log
or git blame
I'd prefer to see dave
than H1234567
.
Can a specific author's name be overridden in config so that all git tools will display the custom name? Alternatively perhaps there is a way to achieve this with gettext? Ideas welcome.
You can do this with a mailmap file, which can translate authors' name and email without modifying history.
Create a file .mailmap
at the repository root with the following:
dave <dave@example.com> H1234567 <H1234567@original.com>
You can set different email address, or keep the original one.
See Documentation/mailmap.txt for more.
这篇关于有一种方法来覆盖本地存储库配置中的git作者的显示名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!