Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Change pushed authors in git.
#!/bin/sh
git filter-branch -f --env-filter '
OLD_EMAIL="jasondevelop@outlook.com"
CORRECT_NAME="Jason Park"
CORRECT_EMAIL="enzinier@gmail.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_AUTHOR_NAME="$CORRECT_NAME"
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags
@enzinier

This comment has been minimized.

Copy link
Owner Author

@enzinier enzinier commented Mar 23, 2017

Run git push --force --tags origin HEAD:master after above script is run for overwrite master branch.

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