$ git commit --amend --author="Author Name <[email protected]>"or
$ git commit --amend --reset-authorIf you need to change the author for a commit older than the most recent, do a git rebase -i. For example, if you wanted to change the penultimate commit, you'd run:
$ git rebase -i HEAD~2Then choose e or edit next to the appopriate commit, then when it asks you to amend, run the same command as you would for the most recent commit:
$ git commit --amend --reset-authorThen, to finish, you'd run:
$ git rebase --continueAnd you're done. Don't forget you'll have to --force push if you've already pushed those commits to your remote.
I had the same problem for 3 years of consistent contributions to many projects, and I didn't care about it. But the day I cared about them, I contacted GitHub support and did my research. Here are the "ready to go" steps:
Take a commit URL, add
.diffor.patchto the end of it, and check if the email there is your correct email used on GitHub. In my case, it was missing an "@".Execute these commands in PowerShell if you are using Windows; otherwise, search for the equivalent for your OS.
git fetch --allgit checkout main # or master, or whichever is your default branch