Removing commits seems a bit extreme, since the code associated with that user would also be lost.
I would install newren/git-filter-repo and rewrite the author of those commits, changing its name/email to a dummy one.
See "How to change commit author for multiple commits using filter branch?" and
"git filter-repo
/ User and email based filtering"
git filter-repo --mailmap my-mailmap
with my-mailmap
:
Correct Name <[email protected]> <[email protected]>
That will rewrite your commits with the right author.
You will then need to git push --force
(assuming one main
branch) in order to override the remote history with your new commits: make sure every collaborator clone the repository again, in order to use the new history.