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.
複製代碼
相關文章
相關標籤/搜索