Skip to content

Instantly share code, notes, and snippets.

@softzer0
Created February 5, 2024 15:30
Show Gist options
  • Save softzer0/2d607cc312c77437a830f98957ae8ef5 to your computer and use it in GitHub Desktop.
Save softzer0/2d607cc312c77437a830f98957ae8ef5 to your computer and use it in GitHub Desktop.
Replace committer/author name and email with one in the whole Git branch
#!/bin/sh
git filter-branch -f --env-filter '
CORRECT_NAME="YourUsername"
CORRECT_EMAIL="[email protected]"
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