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

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

    Just because I came here looking for a one-time solution (in my case, I usually use vim but this one time I wanted to use VS Code) for a single command and others might want to know as well:

    GIT_EDITOR='code -w' git rebase -i …
    

    Here's my git/hub version just for context:

    git version 2.24.2 (Apple Git-127)
    hub version 2.14.1
    

提交回复
热议问题