Configuring git log to use mailmap by default

大憨熊 提交于 2019-12-21 03:27:46

问题


Is there a way to configure git log to use a mailmap file by default? Without having to specify a format (or an alias for one).


回答1:


I have Git 2.4.1. If you set log.mailmap config to true, that will set it to work with git log also

git config --global log.mailmap true



回答2:


You can set up defaults in your .gitconfig file. The documentation says:

log.mailmap

If true, makes git-log, git-show, and git-whatchanged assume --use-mailmap.

This will look for a .mailmap only in the root of the working tree.

To set:

git config --global log.mailmap true

Global mailmap file

mailmap.file

The location of an augmenting mailmap file. The default mailmap, located in the root of the repository, is loaded first, then the mailmap file pointed to by this variable. The location of the mailmap file may be in a repository subdirectory, or somewhere outside of the repository itself. See git-shortlog and git-blame.

To set:

git config --global mailmap.file ~/.mailmap

Advanced

You can also use a repository blob as a mailmap file, see mailmap.blob in the documentation linked to above.




回答3:


It appears that this isn't a feature, yet, due to hysterical raisins.




回答4:


As of git 1.8.2, git log takes a --use-mailmap parameter to enable this behavior.




回答5:


Warning Git 2.23 (Q3 2019) states that a future version of Git would use log.mailmap by default

The "git log" command learns to issue a warning when log.mailmap configuration is not set and --[no-]mailmap option is not used, to prepare users for future versions of Git that uses the mailmap by default.

See commit ef60740, commit 2d9c569, commit f0596ec (15 Jul 2019) by Ariadne Conill (``).
(Merged by Junio C Hamano -- gitster -- in commit c7cf2de, 25 Jul 2019)

log: add warning for unspecified log.mailmap setting

Based on discussions around changing the log.mailmap default to being enabled, it was decided that a transitional period is required.

Accordingly, we announce this transitional period with a warning message.

The warning message is:

log.mailmap is not set; its implicit value will change in an upcoming release.

  • To squelch this message and preserve current behaviour, set the log.mailmap configuration value to false.

  • To squelch this message and adopt the new behaviour now, set the log.mailmap configuration value to true.

Initial description:

People who have changed their name or email address will usually know that they need to set 'log.mailmap' in order to have their new details reflected for old commits with 'git log', but others who interact with them may not know or care enough to enable this option.

Change the default for 'git log' and friends to always use mailmap so that everyone gets to see canonical names and email addresses.



来源:https://stackoverflow.com/questions/13777171/configuring-git-log-to-use-mailmap-by-default

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!