Skip to content

Instantly share code, notes, and snippets.

@fbatiga
Created August 29, 2019 08:26
Show Gist options
  • Select an option

  • Save fbatiga/66ec191f31c6af00eaa4f35fe1a7d471 to your computer and use it in GitHub Desktop.

Select an option

Save fbatiga/66ec191f31c6af00eaa4f35fe1a7d471 to your computer and use it in GitHub Desktop.
rewrite history to remove unwanted email adresses
#!/bin/zsh
echo "making commits from $1 anonymous"
export OLD_EMAIL=$1
export CORRECT_NAME="Enyosolutions"
export CORRECT_EMAIL="new@Email.com"
echo $OLD_EMAIL
git filter-branch -f --env-filter '
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
echo "\n changing git commiter data" $OLD_EMAIL
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
echo "\n changing git author data" $OLD_EMAIL
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