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

后端 未结 27 2074
庸人自扰
庸人自扰 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:52

    In windows 7, while adding the "Sublime" editor it was still giving me an error:

    Aborting commit due to empty commit message.

    Sublime was not able to keep the focus.

    To fix this I opened the .gitconfig file in c:/users/username/ folder and added the following line with --wait option outside the single quotes.

    [core]
          editor = 'F:/Program Files/Sublime Text 2/sublime_text.exe' --wait
    

    Hope its helpful to somebody facing similar issue with Sublime.

提交回复
热议问题