I have a lot of commit with an email that is not valid. I want to replace all instances of this email with a correct one. Really, I need to completely remove an author replacing it with another one. Is it possible?
Asked
Active
Viewed 180 times
2 Answers
0
Yes it is possible, although rewriting history is not a good use case, if you are sharing the git repository with other contributors. Check this post Change the author and committer name and e-mail of multiple commits in Git for more detailed info.

Community
- 1
- 1

adamliesko
- 1,887
- 1
- 14
- 21
0
As an alternative to rewriting history, as has been otherwise pointed out, git provides a mechanism for changing which name and/or email address is displayed without changing history, avoiding the problems which that brings.
You can create a .mailmap
file in the root of the workdir which provides a mapping from the old or wrong e-mail address to the correct one. You can write
<correct@example.com> <wrong@email>
in the file and git-log will show the correct email. Check out git help shortlog for more information

Carlos Martín Nieto
- 5,207
- 1
- 15
- 16