git rebase 修改commit message

838 阅读1分钟

注意⚠️

可以用git log看提交记录 也可以配置(git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit”) 就可以用git lg 查看

注意⚠️ 

这是在rebasing中的意思,如果遇到什么问题

直接git rebase --abort

  1. git rebase -i HEAD~3 (修改 最近三次的commit)

  2. 接步骤1 ,按i(进入编辑)

  3. 把你要改的commit节点的pick 改成 edit

ctrl+c,shift+q,然后wq退出,目前就选择了两个commit点进行rebase,
所以下面会执行两次git commit --amend
  1. git commit --amend (进入修改界面)

然后wq退出

  1. git rebase --continue

注意⚠开始️重复动作!

  1. git commit --amend(修改下一个选择的commit)

然后wq退出

  1. git rebase --continue

因为只有选了两个节点所以就完了

  1. git lg 查看修改成功没有