如何全局配置git以使用特定的编辑器(例如vim)提交消息?


当前回答

在Mac OSX 10中将Sublime Text 2设置为Git提交编辑器

运行以下命令:

$ git config --global core.editor "/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl"

或者只是:

$ git config --global core.editor "subl -w"

其他回答

对于MAC,BBEdit:

首先,打开BBEdit,单击BBEdit徽标,然后选择Install Command Line Tools。

然后从命令行,

git config --global core.editor "BBEdit -w"

对于IntelliJ用户

当我尝试git rebase时,我遇到了以下错误:'提示:正在等待编辑器关闭文件。。。code-n-w:code:未找到命令错误:编辑器“code-n-w”存在问题

当我试图将IntelliJ与Git关联时,出现了同样的错误:

问题是我没有在环境PATH变量中添加命令代码。我不想在我的终端上使用Visual Studio代码。这就是为什么它提示“命令未找到”。我通过删除

编辑器=代码-n-w

从.gitconfig文件的核心部分。Git再次正常工作。

在Git配置中设置core.editor:

git config --global core.editor "nano"

设置GIT_EDITOR环境变量:

export GIT_EDITOR=nano

在Mac OSX 10中将Sublime Text 2设置为Git提交编辑器

运行以下命令:

$ git config --global core.editor "/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl"

或者只是:

$ git config --global core.editor "subl -w"

Atom作为您的git编辑器

git config --global core.editor "atom --wait"

需要将Atom配置为从命令行运行,以使上述功能正常工作:OS X:从Atom安装shell命令:菜单栏>Atom>安装Shell命令Windows:不需要任何操作-默认情况下,atom配置为从命令行运行