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

posted on 2022-02-28 19:48  studyphp  阅读(95)  评论(0编辑  收藏  举报

导航