Skip to content

Instantly share code, notes, and snippets.

@PatricNox
Last active October 7, 2020 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PatricNox/7a97b6dec6daf3986249f730690809a0 to your computer and use it in GitHub Desktop.
Save PatricNox/7a97b6dec6daf3986249f730690809a0 to your computer and use it in GitHub Desktop.
Change author of pushed commits in git
git filter-branch -f --env-filter '
OLD_EMAIL="patric.johansson@ucsit.se"
CORRECT_NAME="PatricNox"
CORRECT_EMAIL="hello@PatricNox.info"
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
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