How many people out there have changed their Git config once? Twice? New email address, change of username, straighten out the mess by filtering the git branch history.

git clone --bare https://hostname/user/repo.git cd repo.git

filter-branch.sh:

#!/bin/sh

git filter-branch --env-filter '

OLD_EMAIL="[email protected]"
CORRECT_NAME="Your Correct Name"
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

Did you leak a password or other sensitive info when committing code? After you update the mistake it is still in the history. Use git filter-repo to remove or replace embarrassing commits.

expressions.txt:

literal:originalpassword==>newpassword
string to replace

Will be replace with ** Removed ** unless provided ==>

git filter-repo --force --replace-text ../expressions.txt

git push origin --force 'refs/heads/*'