LinuxCommandLibrary

git-check-mailmap

Verify mailmap file validity and consistency

TLDR

Look up the canonical name associated with an email address

$ git check-mailmap "<[email@example.com]>"
copy

SYNOPSIS

git check-mailmap [--stdin] [--no-sort | --sort] [--expires=datetime] [--fix] [--pretty] [--source] [-- ]

PARAMETERS

--stdin
    Read the mailmap from standard input instead of a file.

--no-sort
    Do not sort the mailmap entries. The order will be the same as in the input file.

--sort
    Sort the mailmap entries. This is the default.

--expires=datetime
    Apply only mailmaps that are younger than the given time.

--fix
    Run the mailmap fixing routines.

--pretty
    Output the mailmap in a pretty format.

--source
    When running the mailmap fixing routines, display the source of the mailmap entry.


    The mailmap file to check. If not specified, reads from .mailmap in the current directory.

DESCRIPTION

git-check-mailmap is a utility for checking, converting, and applying mailmap files within a Git repository. It helps to normalize author and committer names and email addresses, which is useful when merging contributions from various sources that might have different naming conventions or email addresses. The command primarily interacts with .mailmap files in the repository, allowing you to verify their correctness, transform them into a format suitable for other tools, and apply them to rewrite Git history.

It allows to solve issues with git statistics, when users have different emails and names for the same author.

The main functionality is based around three different use cases, to check the file, to apply it in git history and to convert it to other formats.

CAVEATS

The command modifies Git history when rewriting commits, so it should be used with caution. Ensure you have a backup of your repository before running any history-rewriting operations.

MAILMAP FILE FORMAT

The .mailmap file consists of lines of the following format:
Correct Name

OR

The first format is used when a user changes their name and email, while the second format is used when a user changes only their email.

USAGE SCENARIOS

Common use cases include normalizing email addresses after a domain change, correcting author names, or unifying contributions from users who have used different email addresses across different commits.

HISTORY

The git-check-mailmap command was introduced as a tool to assist in normalizing contributor information across Git repositories. Its development was driven by the need to address inconsistencies in author and committer data when merging contributions from various sources, which could negatively impact contribution statistics and attribution. The command has evolved over time to offer various options for checking, converting, and applying mailmap files, making it a valuable tool for maintaining consistent contributor information in Git projects.

SEE ALSO

git filter-branch(1), git shortlog(1)

Copied to clipboard