# 修改 author 信息
git filter-repo --commit-callback '
if commit.author_email == b"
[email protected]":
commit.author_name = b"New Name"
commit.author_email = b"
[email protected]"
' --force
# 修改 committer 信息
git filter-repo --commit-callback '
if commit.committer_email == b"
[email protected]":
commit.committer_name= b"New Name"
commit.committer_email = b"
[email protected]"
' --force
# 修改全部
git filter-repo --force --commit-callback '
if commit.committer_email == b"
[email protected]":
commit.author_name = b"New Name"
commit.author_email = b"
[email protected]"
commit.committer_name = b"New Name"
commit.committer_email = b"
[email protected]"
'
git filter-repo --force --commit-callback '
if commit.committer_email != b"
[email protected]":
commit.author_name = b"New Name"
commit.author_email = b"
[email protected]"
commit.committer_name = b"New Name"
commit.committer_email = b"
[email protected]"
'
git filter-repo --force --commit-callback '
commit.author_name = b"New Name"
commit.author_email = b"
[email protected]"
commit.committer_name = b"New Name"
commit.committer_email = b"
[email protected]"
'
filter-repo 这个工具,能保持历史时间不变。还有一种是不用任何扩展也能改,但那个时间会切换成当前时间。