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

后端 未结 27 2081
庸人自扰
庸人自扰 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 02:11

    Copy paste this:

    git config --global core.editor "vim"
    

    In case you'd like to know what you're doing. From man git-commit:

    ENVIRONMENT AND CONFIGURATION VARIABLES

    The editor used to edit the commit log message will be chosen from the GIT_EDITOR environment variable, the core.editor configuration variable, the VISUAL environment variable, or the EDITOR environment variable (in that order).

提交回复
热议问题