当前位置:   article > 正文

git修改历史commit信息_git修改commit记录

git修改commit记录

修改历史提交 commit 的信息
操作步骤:

  1. git rebase -i 列出 commit 列表
  2. 找到需要修改的 commit 记录,把 pick 修改为 edit 或 e,:wq 保存退出
  3. 修改 commit 的具体信息git commit --amend,保存并继续下一条git 4. 4. rebase --continue,直到全部完成
  4. 中间也可跳过或退出git rebase (–skip | --abort)
# 列出 rebase 的 commit 列表,不包含 <commit id>
$ git rebase -i <commit id>
# 最近 3 条
$ git rebase -i HEAD~3
# 本地仓库没 push 到远程仓库的 commit 信息
$ git rebase -i

# vi 下,找到需要修改的 commit 记录,```pick```修改为 ```edit```或 ```e```,```:wq```保存退出
# 重复执行如下命令直到完成
$ git commit --amend --only -m "modify message by daodaotest"
$ git rebase --continue

# 中间也可跳过或退出 rebase 模式
$ git rebase --skip
$ git rebase --abort
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

https://cloud.tencent.com/developer/article/1730774

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

闽ICP备14008679号