This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
OLD_EMAIL="oldmail@email.com" | |
NEW_EMAIL="newmail@email.com" | |
# Verify that the old email exists in the commit history | |
if git log --all --grep="$OLD_EMAIL" --author="$OLD_EMAIL" --oneline --quiet; then | |
# Rewrite the Git history | |
git filter-branch --env-filter " | |
if [ \"\$GIT_AUTHOR_EMAIL\" = \"$OLD_EMAIL\" ]; then |
OlderNewer