Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring git log to use mailmap by default

Tags:

git

git-log

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).

like image 928
rich Avatar asked Dec 08 '12 11:12

rich


People also ask

What is git Mailmap?

mailmap exists at the toplevel of the repository, or at the location pointed to by the mailmap. file or mailmap. blob configuration options (see git-config[1]), it is used to map author and committer names and email addresses to canonical real names and email addresses.

What is git log -- all?

To show all of the branches, add --all to your git log command. So basically, without --all you only see the commits that actually make up your current branch.

What is git Shortlog?

The git shortlog command is a special version of git log intended for creating release announcements. It groups each commit by author and displays the first line of each commit message. This is an easy way to see who's been working on what.

What is the use of mailmap in Git?

If the file .mailmap exists at the toplevel of the repository, or at the location pointed to by the mailmap.file or mailmap.blob configuration options (see git-config [1] ), it is used to map author and committer names and email addresses to canonical real names and email addresses.

How does mailmap identify the author of a git commit?

The email (or name and email) in the “find” part of the entry will be used in a case-insensitive way to identify a git author and replace it with whatever is included in the “replace” part which allows mailmap to replace only the email part of a commit, and:

How do I set up my email address in Git?

As you read briefly in Getting Started, you can specify Git configuration settings with the git config command. One of the first things you did was set up your name and email address: $ git config --global user.name "John Doe" $ git config --global user.email [email protected]

How do I change the default values in a git config file?

Git’s configuration files are plain-text, so you can also set these values by manually editing the file and inserting the correct syntax. It’s generally easier to run the git config command, though.


2 Answers

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 
like image 160
Yogesh Arora Avatar answered Oct 01 '22 20:10

Yogesh Arora


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.

like image 39
Tom Hale Avatar answered Oct 01 '22 21:10

Tom Hale