I had the case that I made commits in my local repository with an incorrect email address. Since they weren’t pushed yet, fixing this wasn’t a big thing.
I researched for possible solutions, one was to work with
filter-branch, but I had only two commits to edit so I continued research.
On StackOverflow, I came to this solution:
git rebase -i -p <some HEAD before all of your bad commits>
and mark all commits as edit which got the wrong author name:
edit f7f3f6d changed my name a bit edit 310154e updated README formatting and added blame
git commit --amend --author "New Author Name <firstname.lastname@example.org>"
on every commit you want to change and
git rebase --continue