Update git commit author and email for all commits in repo without changing original commit date

Published: 28/10/2025

GitHub has the feature where they provide you with a noreply email to protect the privacy of your main email and will block you from pushing if you tries to push commits that contain your real email. I have multiple repos that I commited with the "wrong" email address, which causes problem when I try to push them to GitHub for archiving

This command (source) will change the commit author's name and email address, while keeping the original commit date unmodified

git -c rebase.instructionFormat='%s%nexec GIT_COMMITTER_DATE="%cD"
GIT_AUTHOR_DATE="%aD" \
git commit --amend --no-edit --reset-author' rebase -f <commit/branch before wrong author and email, or --root to rebase all> 

Note that this will also change all commits' hashes.