Skip to content

Instantly share code, notes, and snippets.

@minhntm
Created August 27, 2019 06:06
Show Gist options
  • Save minhntm/42099fed72df2b56bee0a208ac9418bf to your computer and use it in GitHub Desktop.
Save minhntm/42099fed72df2b56bee0a208ac9418bf to your computer and use it in GitHub Desktop.
Replaces the committer info for all commits in a branch.
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="Nguyen Tri Minh"
CORRECT_EMAIL="[email protected]"
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment