The easy way to replace an email address across all commits in a repo
A simple tool to replace the email address for all commits in a repo by a user - using a single command. The timestamps and patches of the commits are left as is.
Since a rebase is done here, this tool rewrites your Git history of commits. So you'll have to force-push your changes and get everyone to pull in the changes.
Further, every commit in the history back to the first commit will get rewritten, even if nothing changed in the commits. So don't use this to just fix a few recent commits - rather fix those by hand, or submit an issue or PR improve this tool to only go back to a certain commit!
See further warnings in the git filter-branch docs.
Run the shell script:
$ rewrite_author.sh OLD_EMAIL NEW_MAIL
Then check your Git log and force push if you're satisfied.
e.g. If your ran this:
$ rewrite_author.sh old@example.com new@another-example.com
Then your commits will be changed from the old email like:
Author: Foo Bar old@example.com
Date: Thu Jun 24 20:08:18 2021 +0200
To the new email:
Author: Foo Bar new@another-example.com
Date: Thu Jun 24 20:08:18 2021 +0200
Instead of using this tool, see git filter-name.
See that for how to set up and run this tool and for more info on how this works.
It also has instructions for how to update an email address for a single commit with plain Git.
Released under MIT by @MichaelCurrin.