
新换了老板,查看报表时候,发现我以往的 commit 邮箱不是公司邮箱
我也比较纳闷。。。我记得我还专门设置过,排查下来,可能是 git 工具把我登录的账号默认的 git 配置给覆盖了
现在问题来了,该如何把已经 push 到远程仓库的所有有关我的 commit 的邮箱全部修改啊
求教大佬
|  |      1maichael      17 小时 6 分钟前  1 git-filter-repo 之类的工具,具体用法你问 AI 就好,不过肯定是要 force push 的,谨慎操作。 | 
|  |      2dif      17 小时 4 分钟前 git filter-branch 试试 小声 bb ,不都看你需求单和缺陷工单么?怎么会看提交呢- - 我这修改一个小功能提交一次,那不得预定优秀员工? | 
|  |      3lixyz OP | 
|      4victimsss      16 小时 54 分钟前 commit hash 包括提交者信息和时间吧 你用工具修改了邮箱 之前的 commit hash 也会重写 对整个仓库的提交者都有影响 | 
|  |      5skiy      16 小时 52 分钟前 # 修改 author 信息 git filter-repo --commit-callback ' if commit.author_email == b"[email protected]": commit.author_name = b"New Name" commit.author_email = b"[email protected]" ' --force # 修改 committer 信息 git filter-repo --commit-callback ' if commit.committer_email == b"[email protected]": commit.committer_name= b"New Name" commit.committer_email = b"[email protected]" ' --force # 修改全部 git filter-repo --force --commit-callback ' if commit.committer_email == b"[email protected]": commit.author_name = b"New Name" commit.author_email = b"[email protected]" commit.committer_name = b"New Name" commit.committer_email = b"[email protected]" ' git filter-repo --force --commit-callback ' if commit.committer_email != b"[email protected]": commit.author_name = b"New Name" commit.author_email = b"[email protected]" commit.committer_name = b"New Name" commit.committer_email = b"[email protected]" ' git filter-repo --force --commit-callback ' commit.author_name = b"New Name" commit.author_email = b"[email protected]" commit.committer_name = b"New Name" commit.committer_email = b"[email protected]" ' filter-repo 这个工具,能保持历史时间不变。还有一种是不用任何扩展也能改,但那个时间会切换成当前时间。 | 
|  |      6icyalala      16 小时 50 分钟前 如果只是为了统计代码行数,那分邮箱统计出来后,再按单用户多邮箱合并一下不就行了 为什么要去改 git 历史呢。。。 | 
|      8mach9452      16 小时 41 分钟前 学会拒绝 | 
|  |      9awsl2333      15 小时 37 分钟前 只能 rebase + push -f 了 | 
|      10svon      14 小时 55 分钟前 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 | 
|      11wenrouxiaozhu      13 小时 49 分钟前 还有注意`GIT_COMMIT_DATE`和`GIT_AUTHOR_DATE` | 
|  |      12wweir      12 小时 46 分钟前 | 
|      13unused      12 小时 11 分钟前 mailmap 支持吗? https://git-scm.com/docs/gitmailmap |