Update Your Git Commit Email Address Before Pushing to Remote Repository
Here's a quick way to update commit author email and display name for previous commits in a local project.
Two things worth mentioning before using this:
If you change your email, it might no longer count as contributions on your GitHub/GitLab profile. But as long as you keep the old email as a hidden email connected to your account, it should work.
Remember that rewriting history in shared projects is a bad idea. Especially when working in a collaborative environment with other people. But for old local projects that you want to upload to a public Git repository, this method could be useful to hide some personal information.
Let's use git-filter-repo which is a modern replacement to git filter-branch
and can be installed via package managers or by following the official install guide.
Once installed, we can update the email like this:
If you also want to update your name, you can run this command:
Credit: StackOverflow