如何将Git项目提交历史中的作者和邮箱改为?
摘要:前提: 单人项目(不适合多人协作项目) 全局重置commit历史提交记录中的name和email 适合单人项目中,写错name与email后,重置项目的全部分支的commit历史 1. 安装 git-filter-
前提:
单人项目(不适合多人协作项目)
全局重置commit历史提交记录中的name和email
适合单人项目中,写错name与email后,重置项目的全部分支的commit历史
1. 安装git-filter-repo
pip install git-filter-repo
2. 指定name和email
git filter-repo --force --commit-callback @"
commit.author_name = b'新名字'
commit.author_email = b'新邮箱'
commit.committer_name = b'新名字'
commit.committer_email = b'新邮箱'
"@
3. 重新添加远程仓库(filter-repo 会移除 remote)
git remote add origin <your-repo-url>
4. 进行旧分支删除,与新分支推送
git push --force --all origin
