如何使用 git filter-repo 修改某次commit 的作者信息
使用 git filter-repo 命令可以修改某次 commit 的作者信息,具体步骤如下:
-
安装 git filter-repo 工具,可以使用以下命令:
pip3 install git-filter-repo -
切换到要修改的仓库目录,执行以下命令:
git filter-repo --commit-callback ' if commit.committer.name == "old_author_name": commit.committer.name = "new_author_name" commit.committer.email = "new_author_email" ' --force其中,
old_author_name是原来的作者名,new_author_name是要修改成的作者名,new_author_email是要修改成的作者邮箱。 -
执行完命令后,使用 git log 命令查看修改后的 commit 记录,确认修改成功。
注意:修改 commit 记录会改变仓库的历史记录,可能会导致其他人的协作出现问题,建议在不影响其他人的情况下进行修改。
原文地址: https://www.cveoy.top/t/topic/BzY 著作权归作者所有。请勿转载和采集!