更改以前提交的git电子邮件 [英] Change git email for previous commits
问题描述
因此,我读了很多关于如何更改之前提交的电子邮件地址,但由于某些原因,我的更新没有更新。
我用我的本地电子邮件(nameofMyComputer@kevin.local)向我的私人回购提交了40份提交,因为这封电子邮件没有关联be)with github。
然后我记得我之前需要设置git.config,所以我做了:
git config user.emailnewemail@example.com
有没有一种方法可以将我以前的所有提交都还原为这封新邮件?
我在SO Change Git中的多个提交的作者和提交者姓名和电子邮件,并使用它
git filter-branch - f --env-filter
GIT_AUTHOR_EMAIL='kevin.cohen26@gmail.com';
GIT_COMMITTER_EMAIL='kevin.cohen26@gmail.com';
HEAD
但它不起作用...我仍然可以看到电子邮件我以前用.patch扩展名作为.local电子邮件地址提交
您确实可以一次完成许多提交这:
git rebase -i HEAD〜40 -xgit commit --amend --author'作者姓名< author .name @ mail.com>'--no-edit
a href =https://stackoverflow.com/a/31669789/2082964>这个答案。
So I read a lot about how to change previous commit's email address but for some reason mine is not updating.
I did like 40 commits to my private repo with my local email (nameofMyComputer@kevin.local) which is bad since this email is not associated(and it can't be) with github.
I then remembered that I needed to set the git.config before and so I did:
git config user.email "newemail@example.com"
and did a test commit and it worked perfectly.
Is there a way I can revert all my previous commits to this new email?
I read this question on SO Change the author and committer name and e-mail of multiple commits in Git and used this
git filter-branch -f --env-filter "
GIT_AUTHOR_EMAIL='kevin.cohen26@gmail.com';
GIT_COMMITTER_EMAIL='kevin.cohen26@gmail.com';
"
HEAD
But it DID NOT work... I can still see the email of my previous commits with the .patch extension as the .local email address
You can indeed do his for many commits at once like this:
git rebase -i HEAD~40 -x "git commit --amend --author 'Author Name <author.name@mail.com>' --no-edit"
I worked this out better in this answer.
这篇关于更改以前提交的git电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!