Skip to content

Instantly share code, notes, and snippets.

@mackatozis
Created November 25, 2022 17:22
Show Gist options
  • Save mackatozis/1be66461094380901d8db9fa4507814f to your computer and use it in GitHub Desktop.
Save mackatozis/1be66461094380901d8db9fa4507814f to your computer and use it in GitHub Desktop.
Git: reset author for ALL commits
#!/bin/bash
git filter-branch -f --env-filter '
OLD_EMAIL="xxxxxxxxxxxxxxxxxxxxxxxxxx"
CORRECT_NAME="zzzzzzzzzzzzzzzzz"
CORRECT_EMAIL="yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
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
' HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment