Skip to content

Instantly share code, notes, and snippets.

@oliveira-andre
Created August 12, 2020 17:58
Show Gist options
  • Select an option

  • Save oliveira-andre/b8fd189985766f08789a820c882fb894 to your computer and use it in GitHub Desktop.

Select an option

Save oliveira-andre/b8fd189985766f08789a820c882fb894 to your computer and use it in GitHub Desktop.
script to change old email on all commits and put new email

script to change old email on all commits and put new email

changing commits

git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
    export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
    export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags

forcing push

git push -f origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment