当前位置:   article > 正文

git修改远程commit信息_git 修改远程提交信息

git 修改远程提交信息

git 修改远程commit信息

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

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

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

git  rebase -i  b6a75e0056746faaaxxxxxx 
  • 1

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

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

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

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

git commit --amend
  • 1

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

git rebase --continue
  • 1

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

git push origin  branchName --force
  • 1

结束

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/黑客灵魂/article/detail/914640
推荐阅读
相关标签
  

闽ICP备14008679号