gitmailmap - Linux


gitmailmap maps author and committer email addresses to new email addresses. It is used to clean up the history of a Git repository by replacing old email addresses with new ones. This can be useful when a developer changes their email address or when a company merges with another company.


gitmailmap [-d] [-q] [-v <verbosity>] <old-email-1> <new-email-1>


  • -d: Dry run mode. Do not actually rewrite history.
  • -q: Quiet mode. Suppress output.
  • -v <verbosity>: Specify verbosity level. Verbosity levels are:
    • 0: Only show errors.
    • 1: Show errors and warnings.
    • 2: Show errors, warnings, and success messages.
    • 3: Show errors, warnings, success messages, and debug information.


To replace the email address with, run:


To map multiple email addresses at once, use multiple pairs of email addresses:


To run in dry run mode, use the -d option:

gitmailmap -d

Common Issues

One common issue that can occur is that gitmailmap may not find all of the commits that need to be rewritten. This can happen if the commits were made by a different user or if the email address was changed in a different branch. To solve this, you can use the -d option to see which commits would be rewritten and then manually rewrite the ones that are not.


gitmailmap can be used with other Git commands to clean up the history of a repository. For example, you can use git rebase to rewrite the history of a branch and then use gitmailmap to clean up the email addresses.

Related Commands

  • git-filter-branch
  • git-rebase