Skip to content

Instantly share code, notes, and snippets.

@lexjacobs
Created November 4, 2020 22:55
Show Gist options
  • Save lexjacobs/8723c72a5b199a37ce2d4b233e470ac3 to your computer and use it in GitHub Desktop.
Save lexjacobs/8723c72a5b199a37ce2d4b233e470ac3 to your computer and use it in GitHub Desktop.
rewrite particular author for all commit history (majorly destructive. use with awareness and care)
git filter-branch --env-filter '
WRONG_EMAIL="wrong@example.com"
NEW_NAME="New Name Value"
NEW_EMAIL="correct@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$WRONG_EMAIL" ]
then
export GIT_COMMITTER_NAME="$NEW_NAME"
export GIT_COMMITTER_EMAIL="$NEW_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$WRONG_EMAIL" ]
then
export GIT_AUTHOR_NAME="$NEW_NAME"
export GIT_AUTHOR_EMAIL="$NEW_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags
@lexjacobs
Copy link
Author

link to original source of info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment