使用 git rebase 修改commit message

2016-09-04  本文已影响294人  HeminWon

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

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
上一篇 下一篇

猜你喜欢

热点阅读