'How do I fix the email in the 10 latest git commits?
I want to fix the email in the 10 most recent git commits (while keeping the timestamp when they were originally committed, like git rebase does).
Alas, I cannot use --reset-author because it also resets the timestamp.
I suppose I can use git format-patch, then use sed to fix the email, and then git am to apply them.
Is there an easier way?
Solution 1:[1]
Git filter-repo is probably the best tool for this! Construct a mailmap like so:
Old Name <[email protected]> Correct Name <[email protected]>
Save this in a file called mailmap.txt or something (it can be named anything).
Then, run git filter-repo in a fresh clone:
git filter-repo --mailmap path/to/mailmap.txt
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alecto Irene Perez |
