Configuring git log to use mailmap by default

2019-06-14 21:24发布

问题:

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, it 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.



标签: git git-log