git history to change the mailbox information submitted

original:

https://help.github.com/en/articles/changing-author-info

1. Change the Local History

git filter-branch -f --env-filter '

OLD_EMAIL="老的邮箱地址"
CORRECT_NAME="新用户名"
CORRECT_EMAIL="新邮箱地址"

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

2. Change the historic push to the server

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

Guess you like

Origin blog.csdn.net/xiaohe73/article/details/88185540