git修改提交历史邮箱地址

如果Git需要修改提交作者信息,名字邮箱名,可以用变基

1、找到需要修改信息的上一条sha值,执行:git rebase -i sha值

2、会出现一个文本

pick a4959eb ****

pick 5e10451 ****

# Rebase 1bd28ff..5e10451 onto 1bd28ff (2 commands)

#

# Commands:

# p, pick = use commit

# r, reword = use commit, but edit the commit message

# e, edit = use commit, but stop for amending

# s, squash = use commit, but meld into previous commit

# f, fixup = like "squash", but discard this commit's log message

# x, exec = run command (the rest of the line) using shell

# d, drop = remove commit

 

把其中的pick修改成edit,保存文本并关闭

 

3、出现这样的提示

Stopped at d9252d1f... *******

You can amend the commit now, with

 

  git commit --amend

 

Once you are satisfied with your changes, run

 

  git rebase --continue

  

4、输入git commit --amend --author "作者名字 <邮箱地址>" --no-edit

 

[detached HEAD 17f5733a] *****

 Date: Sat May 6 17:45:49 2023 +0800

 2 files changed, 122 insertions(+)

 create mode 100644 *****

 create mode 100644 *****

 

5、接着输入git rebase --continue

 进入下一层提交

6、重复4、5,直到出现

Successfully rebased and updated refs/heads/*****

 

7、这时需要把变基后的提交强制推送到远端

 git push --force origin 分支名

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值