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).
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
pretty-formats
log, the setting above is ignored. Instead, look up the .mailmap
-respecting placeholders (%aN
, %aE
for author and %cN
, %cE
for committer). –
Mawkish You can set up defaults in your .gitconfig
file. The documentation says:
log.mailmap
If true, makes
git-log
,git-show
, andgit-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
andgit-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.
As of git 1.8.2, git log
takes a --use-mailmap
parameter to enable this behavior.
It appears that this isn't a feature, yet, due to hysterical raisins.
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 unspecifiedlog.mailmap
settingBased 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 tofalse
.To squelch this message and adopt the new behaviour now, set the
log.mailmap
configuration value totrue
.
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.
With Git 2.27 (Q2 2020), "git log
" learns "--[no-]mailmap
" as a synonym to "--[no-]use-mailmap
"
See commit 88acccd, commit c28b036, commit 7c28058 (16 Mar 2020) by Junio C Hamano (gitster
).
(Merged by Junio C Hamano -- gitster
-- in commit 9404128, 28 Apr 2020)
log
: give--[no-]use-mailmap
a more sensible synonym--[no-]mailmap
The option name "
--use-mailmap
" looks OK, but it becomes awkward when you have to negate it, i.e. "--no-use-mailmap
".I, perhaps with many other users, always try "
--no-mailmap
" and become unhappy to see it fail.Add an alias "
--[no-]mailmap
" to remedy this.
© 2022 - 2024 — McMap. All rights reserved.