git修改远程commit信息

git 修改远程commit信息

如果你已经把本地commit的信息push到远程了,此时需要修改远程中的commit信息

第一步:git log 查看提交的信息,看下提交的commit日志
如下入所示
在这里插入图片描述
第二步:然后确定你需要修改的那一次commit,比如:b6a75e0056746faaaxxxxxx 的这一次

第三步:使用git rebase -i 命令

git  rebase -i  b6a75e0056746faaaxxxxxx 

命令回车后会显示下面的信息

pick f3f4f7d changed my name a bit
pick 511164e updated README formatting and added blame
pick b5c4h0d added cat-file

# Rebase xxxxx onto xxxxx
#
# 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
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out

此时敲击键盘上的i 键 ,进入编辑模式,然后把比如:f3f4f7d 这次的要修改掉,就把前面的pick,改成edit,然后按:wq,保存

第四步:输入命令: git commit --amend ,进入编辑,此时会进入到你需要修改的commit信息中,然后修改完信息后,输入:wq保存

git commit --amend

第五步: 输入命令:git rebase --continue

git rebase --continue

第六步: 输入命令: git push origin branchName(分支名称) --force

git push origin  branchName --force

结束

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值