In git, I would like to amend my name and email address for the entire history of a repository.
Is there a command to do this and if there is, are there any risks associated with doing this?
答案 0 :(得分:0)
以下是您要使用的代码段代码。 (应该是单行,打破格式化)
您可以更改任何值 - 姓名/电子邮件等。
git filter-branch --commit-filter
'if [ "$GIT_AUTHOR_NAME" = "old_name" ];
then
export GIT_AUTHOR_NAME="new_name";
export GIT_AUTHOR_EMAIL="new_email";
fi;
git commit-tree "$@"
'
如果您想使用它们,还有更多选项,但这是。
阅读完整文档here,特别是git filter-branch
。