Skip to content

Instantly share code, notes, and snippets.

@MarcusJohnson91
Last active March 25, 2020 23:45
Show Gist options
  • Save MarcusJohnson91/d95147b24b9671f6d5a1d181266902e4 to your computer and use it in GitHub Desktop.
Save MarcusJohnson91/d95147b24b9671f6d5a1d181266902e4 to your computer and use it in GitHub Desktop.
Fixes the author and committer name and email in git
git filter-branch -f --env-filter '
CORRECT_NAME="YOUR_REAL_NAME"
CORRECT_EMAIL="YOUR_EMAIL_ADDRESS@WEBSITE.TLD"
if [ "$GIT_COMMITTER_EMAIL" != "$CORRECT_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" != "$CORRECT_EMAIL" ]
then
export GIT_AUTHOR_NAME="$CORRECT_NAME"
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_COMMITTER_NAME" != "$CORRECT_NAME" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_NAME" != "$CORRECT_NAME" ]
then
export GIT_AUTHOR_NAME="$CORRECT_NAME"
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment