Skip to content

Instantly share code, notes, and snippets.

@lyluongthien
Created March 6, 2021 12:10
Show Gist options
  • Save lyluongthien/2f7d75b896c7f313be427f92d692895a to your computer and use it in GitHub Desktop.
Save lyluongthien/2f7d75b896c7f313be427f92d692895a to your computer and use it in GitHub Desktop.
Fix user info(name, email) of old git commits
#bin/bash
git filter-branch --env-filter '
WRONG_EMAIL="thien.ly@tikii.vn"
NEW_NAME="Lý Lưỡng Thiên"
NEW_EMAIL="thien.ly@tiki.vn"
if [ "$GIT_COMMITTER_EMAIL" = "$WRONG_EMAIL" ]
then
export GIT_COMMITTER_NAME="$NEW_NAME"
export GIT_COMMITTER_EMAIL="$NEW_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$WRONG_EMAIL" ]
then
export GIT_AUTHOR_NAME="$NEW_NAME"
export GIT_AUTHOR_EMAIL="$NEW_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