Replace All Previous Git Commit Name and Email
If you mistakenly use your personal email address to commit changes to a work repo, you can change the commit name and email using this method. Proceed with extreme caution as this cannot be undone.
Proceed with caution!!!
This will replace the name and email of all previous commits!
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='Newname'
GIT_AUTHOR_EMAIL='new@email'
GIT_COMMITTER_NAME='Newname'
GIT_COMMITTER_EMAIL='new@email'
" HEAD
Hold Shift
and click Enter
to add nice line breaks.