Fixed "There was a problem with the editor 'vi'"

在用git提交的时候 若是不当心打错了commit -m 'xxx' xxx里面的内容的话,能够修改,命令是git commit --amendgit

apple:yunlu_meeting apple$ git commit -m 'delete redu'
//这时候发现打字还没打完 电脑卡了手贱 多按了回车,郁闷,因而再一次修改提交信息
apple:yunlu_meeting apple$ git commit --amend
//WTF,`Vi`编辑器遇到问题,
error: There was a problem with the editor 'vi'.
Please supply the message using either -m or -F option.
复制代码

解决方法是vim

$ git config --global core.editor /usr/bin/vim -f
复制代码

完整的终端打印以下:app

apple:yunlu_meeting apple$ git commit --amend
error: There was a problem with the editor 'vi'.
Please supply the message using either -m or -F option.
apple:yunlu_meeting apple$ git config --global core.editor  /usr/bin/vim -f 
apple:yunlu_meeting apple$ git commit --amend
[addChat e38cfe4] delete redundant key-values in HBuilder-Hello-Info.plist
 Date: Sat Oct 8 17:48:46 2016 +0800
apple:yunlu_meeting apple$ git push origin addChat:addChat
Counting objects: 198, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (114/114), done.
复制代码
相关文章
相关标签/搜索