Skip to content

MichaelCurrin/rewrite-git-author

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rewrite Git Author

The easy way to replace an email address across all commits in a repo

GitHub tag License

Made with Bash

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.

⚠️ Warning

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.

Sample usage

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

Alternative

Instead of using this tool, see git filter-name.

Documentation

view - Documentation

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.

License

Released under MIT by @MichaelCurrin.