Skip to content

Instantly share code, notes, and snippets.

@BlueNoob
Forked from rise-worlds/git-rewrite-author.sh
Created November 26, 2020 11:39
Show Gist options
  • Save BlueNoob/de043f850f1e3c1f2a41729a4190d9ba to your computer and use it in GitHub Desktop.
Save BlueNoob/de043f850f1e3c1f2a41729a4190d9ba to your computer and use it in GitHub Desktop.
#!/bin/bash
git filter-branch --env-filter '
OLD_EMAIL="rise.worlds@outlook.com"
NEW_NAME="a42dab9659090cac"
NEW_EMAIL="a42dab9659090cac@outlook.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$NEW_NAME"
export GIT_COMMITTER_EMAIL="$NEW_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_AUTHOR_NAME="$NEW_NAME"
export GIT_AUTHOR_EMAIL="$NEW_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags
# git gc
# git push --force --tags origin 'refs/heads/*'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment