我可以在以前的所有提交中更改我的名字和姓氏吗? [英] Could I change my name and surname in all previous commits?
本文介绍了我可以在以前的所有提交中更改我的名字和姓氏吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在我的所有提交中更改我的姓名和电子邮件地址,这是可能的吗?
使用 git-filter-branch 。$ b $
git filter-branch --commit-filter'if [$ GIT_AUTHOR_NAME=Josh Lee];
然后导出GIT_AUTHOR_NAME =Hobo Bob;导出GIT_AUTHOR_EMAIL = hobo@example.com;
fi; git commit-tree$ @'
这只影响作者,而不是提交者大多数提交将与作者相同)。如果您想重写这些内容,请设置 GIT_COMMITTER_NAME
和 GIT_COMMITTER_EMAIL
变量。
关于重写历史的标准警告适用;只做到尚未共享的历史记录。
I would like to change my name, surname and email in my all commits, is it possible?
解决方案
Use git-filter-branch
.
git filter-branch --commit-filter 'if [ "$GIT_AUTHOR_NAME" = "Josh Lee" ];
then export GIT_AUTHOR_NAME="Hobo Bob"; export GIT_AUTHOR_EMAIL=hobo@example.com;
fi; git commit-tree "$@"'
This only affects the author, not the committer (which for most commits will be the same as the author). If you want to rewrite those as well, set the GIT_COMMITTER_NAME
and GIT_COMMITTER_EMAIL
variables.
The standard warning about rewriting history applies; only do it to history that has not yet been shared.
这篇关于我可以在以前的所有提交中更改我的名字和姓氏吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文