【发布时间】:2016-04-23 09:27:26
【问题描述】:
所以我读了很多关于如何更改以前提交的电子邮件地址的内容,但由于某种原因我的没有更新。
我确实喜欢使用我的本地电子邮件 (nameofMyComputer@kevin.local) 对我的私人仓库进行 40 次提交,这很糟糕,因为这封电子邮件与 github 没有关联(而且不可能)。
然后我记得我需要在之前设置 git.config,所以我做了:
git config user.email "newemail@example.com"
并进行了测试提交,它运行良好。
有没有办法可以将我之前的所有提交还原到这封新电子邮件?
我在 SO Change the author and committer name and e-mail of multiple commits in Git 上阅读了这个问题并使用了这个
git filter-branch -f --env-filter "
GIT_AUTHOR_EMAIL='kevin.cohen26@gmail.com';
GIT_COMMITTER_EMAIL='kevin.cohen26@gmail.com';
"
HEAD
但它不起作用......我仍然可以看到我之前提交的电子邮件,扩展名为 .patch 作为 .local 电子邮件地址
【问题讨论】:
-
我相信您将不得不重写您的分支的历史来更改电子邮件,这些电子邮件似乎与提交者的姓名一起出现。如果您可以接受,那么
filter-branch或git rebase应该可以解决问题。
标签: git git-commit git-rewrite-history