git修改commit用户名和邮箱
查看提交记录
git log # 选择要修改的提交的上一次提交ID
修改记录
git rebase -i ID
若报错
error: cannot rebase: Your index contains uncommitted changes.
error: Please commit or stash them.
执行一下
git stash
重新执行
git rebase -i ID
进入vim编辑页面
输入i 开启编辑模式
需要修改哪个commit就在行首将pick
改为edit
保存退出
按esc键,输入:wq
修改用户名和邮箱
git commit --amend --reset-author
此次提交的作者及邮箱会被修改为--local
级别的用户名及邮箱,若该级别没有设置,则会使用--global
级别的用户名及邮箱
自定义用户名和邮箱可以用这个
git commit --amend --author="用户名 <邮箱>"
保存
git rebase --continue
修改完成
同步远程
git push -f origin 分支