How do I make Git use the editor of my choice for commits?

后端 未结 27 2145
庸人自扰
庸人自扰 2020-11-22 01:33

I would prefer to write my commit messages in Vim, but it is opening them in Emacs.

How do I configure Git to always use Vim? Note that I want to do this globally,

27条回答
  •  無奈伤痛
    2020-11-22 01:59

    For IntelliJ users

    When i was trying to git rebase i was getting the following error: 'hint: Waiting for your editor to close the file... code -n -w: code: command not found error: There was a problem with the editor 'code -n -w'.'

    The same error showed up when i was trying to associate IntelliJ with Git:

    The problem was that I did not have the command code added in my environment PATH variable. And i didn't want to use Visual Studio Code from my terminal. So that is why it prompted "command not found". I solved this by deleting

    editor = code -n -w

    from the core section in my .gitconfig file. Git worked properly again.

提交回复
热议问题