Git Commits
Rewrite Old Commits with the Correct Info If you already made commits with the wrong name/email and you want to fix your commit history, follow this: 1git filter-branch --env-filter ' 2OLD_EMAIL="wrong@email.com" 3CORRECT_NAME="Your Correct Name" 4CORRECT_EMAIL="your.correct@email.com" 5 6if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]; then 7 export GIT_COMMITTER_NAME="$CORRECT_NAME" 8 export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" 9fi 10if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]; then 11 export GIT_AUTHOR_NAME="$CORRECT_NAME" 12 export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" 13fi 14' --tag-name-filter cat -- --branches --tags Rewrite every commit with the correct identity This doesn’t care what the old name/email was — it just replaces everything! 💥 ...