Skip to content

Instantly share code, notes, and snippets.

@wolfc
Created July 16, 2012 08:16
Show Gist options
  • Save wolfc/3121492 to your computer and use it in GitHub Desktop.
Save wolfc/3121492 to your computer and use it in GitHub Desktop.
Rename an email address on the current branch
#!/bin/sh
if [ $# != 2 ]; then
echo 1>&2 "Usage: $0 <old-email> <new-email>"
exit 1
fi
export OLD_EMAIL="$1"
export NEW_EMAIL="$2"
git filter-branch -f --env-filter \
'if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]; then
export GIT_AUTHOR_EMAIL="$NEW_EMAIL"; fi
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]; then
export GIT_COMMITTER_EMAIL="$NEW_EMAIL"; fi'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment