所以我读了很多关于如何更改以前提交的电子邮件地址的信息,但由于某种原因我的电子邮件地址没有更新。
我确实喜欢使用我的本地电子邮件 (nameofMyComputer@kevin.local) 对我的私有(private)存储库进行 40 次提交,这很糟糕,因为该电子邮件与 Github 没有关联(也不可能关联)。
然后我想起我之前需要设置 git.config,所以我这样做了:
git config user.email "newemail@example.com"
并进行了测试提交,效果非常好。
有什么方法可以将我之前的所有提交恢复到这封新电子邮件吗?
我在 SO How do I change the author and committer name/email for multiple commits? 上读到了这个问题并使用了这个
git filter-branch -f --env-filter "
GIT_AUTHOR_EMAIL='newemail@example.com';
GIT_COMMITTER_EMAIL='newemail@example.com';
"
HEAD
但它不起作用...我仍然可以看到我以前提交的电子邮件,其扩展名为 .patch 作为 .local 电子邮件地址
最佳答案
您确实可以像这样同时进行许多提交:
git rebase -i HEAD~40 -x "git commit --amend --author 'Author Name <author.name@mail.com>' --no-edit"
我在 this answer 中更好地解决了这个问题.
关于git - 更改以前提交的 git 电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34850831/