git批量修改已经提交的commit的姓名和邮箱

 

首先,我们创建change.sh脚本,并根据个人信息复制以下脚本。 #!/bin/sh

git filter-branch --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

将脚本移入要修改的git仓库,并执行脚本。修改后的 log 信息如下。

3

通过git push --force强行推送修改后的 log 信息。

哈哈,我的 github又重新绿了起来。

https://stackoverflow.com/questions/750172/how-to-change-the-author-and-committer-name-and-e-mail-of-multiple-commits-in-gi?rq=1 https://help.github.com/articles/changing-author-info/

猜你喜欢

转载自www.cnblogs.com/codeking100/p/10324579.html