git强制更新历史的commit用户名邮箱信息
目录下,创建下面的脚本,执行一下就可以了(注意去除master保护)
git filter-branch -f --env-filter ' OLD_EMAIL="" CORRECT_NAME="cgy1" CORRECT_EMAIL="cgy1@xxx.com" 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
执行:
git push origin --force --all