美文网首页
使用 git rebase 修改commit message

使用 git rebase 修改commit message

作者: HeminWon | 来源:发表于2016-09-04 13:29 被阅读294次

适用场景:在实际开发项目中,在commit的时候需要按照团队约定的规范编写commit message的内容。个人偶尔会有需要修改commit meaage的需求,下面是更改的方法以及可能会遇到的问题。

  • 在此过程中遇到'vi'的error导致最后无法成功:
error: There was a problem with the editor 'vi'.
Please supply the message using either -m or -F option.

GitHub的Issues中的解决方法:

git config --global core.editor /usr/bin/vim

commit 没有 git push 前的解决方法

Image001 假设在本地进行四次commit,第三次提交信息003 test希望更改为003

Image001.png
  1. Terminal中进入对应的commit
git rebase -i HEAD~2
Image002.png
  1. 按照vi提示修改提交内容
    Image003.png
    进入Image004界面输入E重新编辑commit内容
    Image004.png
Image005.png Image006.png

相关文章

网友评论

      本文标题:使用 git rebase 修改commit message

      本文链接:https://www.haomeiwen.com/subject/tressttx.html