Following on from a previous post about rewriting indentation for an entire git repo, another reason to rewrite the history of a whole repo is to change the email address or name mentioned in commits.
Once again, be aware that rewriting history will cause problems if other people have clones of the repo so make sure you understand the risks before doing this!
To change the author name and email address for every commit, you can run this:
1 2 3 4 5 6
This will blindly replace all the commits with the details given, but if other people have contributed, you may need to be a bit more careful and only replace your own:
1 2 3 4 5 6 7 8 9 10 11 12
If you understand the risks of rewriting history for a shared repository, you
can force push with the
Then, to ensure future commits don’t use the wrong name and email, you can set it explicity for this particular repo (instead of globally) with these commands:
Keep in mind this will only work for this particular clone as the details will
be stored locally in