单人git项目 重置commit历史记录中的 提交人 提交邮箱

前提:

单人项目(不适合多人协作项目)

全局重置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

 

  

 

posted @ 2026-03-30 18:06  人间春风意  阅读(7)  评论(0)    收藏  举报