<repo_name>maks-io/change-git-author-info-script-extended<file_sep>/README.md
# change-git-author-info-script-extended
This is a clone of the script, that changes the author info in a git repository. The original script can be found here: https://help.github.com/en/articles/changing-author-info - i made a minor adjustment to replace multiple users/emails in a single run.

1) Put the script in the root folder of your repo
2) Adjust the values of the variables `ARRAY_OF_OLD_EMAILS`, `CORRECT_NAME` and `CORRECT_EMAIL`
3) Run the script
<file_sep>/rename.sh
#!/bin/sh

git filter-branch --env-filter '

ARRAY_OF_OLD_EMAILS=("YOUR_OLD_EMAIL_ONE" "YOUR_OLD_EMAIL_TWO" "YOUR_OLD_EMAIL_THREE")
CORRECT_NAME="YOUR_NEW_NAME"
CORRECT_EMAIL="YOUR_NEW_EMAIL"

containsElement () {
  local e match="$1"
  shift
  for e; do [[ "$e" == "$match" ]] && return 0; done
  return 1
}

if containsElement "$GIT_COMMITTER_EMAIL" "${ARRAY_OF_OLD_EMAILS[@]}";
then
    export GIT_COMMITTER_NAME="$CORRECT_NAME"
    export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if containsElement "$GIT_AUTHOR_EMAIL" "${ARRAY_OF_OLD_EMAILS[@]}";
then
    export GIT_AUTHOR_NAME="$CORRECT_NAME"
    export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags
