Skip to content

Instantly share code, notes, and snippets.

@takehaya
Created March 22, 2020 06:50
Show Gist options
  • Save takehaya/6105d3a01f7fa141a0d4d47c0e2a8b7b to your computer and use it in GitHub Desktop.
Save takehaya/6105d3a01f7fa141a0d4d47c0e2a8b7b to your computer and use it in GitHub Desktop.
Shell script to change at once when developing with git with wrong address and name
#/bin/zsh
git filter-branch -f --env-filter '
OLD_EMAIL=""
CORRECT_NAME="takehaya"
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
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment