Jas*_*ong 1 git editor git-config
我收到以下错误消息,当我尝试运行git rebase -i压缩我的提交时:
/usr/libexec/git-core/git-sh-setup: line 112: mate: command not found
Run Code Online (Sandbox Code Playgroud)
git如何寻找编辑器?从git-sh-setup文件中,我只能看到这个方法:
git_editor() {
if test -z "${GIT_EDITOR:+set}"
then
GIT_EDITOR="$(git var GIT_EDITOR)" || return $?
fi
eval "$GIT_EDITOR" '"$@"'
}
Run Code Online (Sandbox Code Playgroud)
~/.gitconfig这样的设置:
[core]
editor = mate
Run Code Online (Sandbox Code Playgroud)
如果您已textmate添加到您,PATH那么您可以将其更改为:editor = mate.只需确保它已添加到那里.
echo $PATH 检查文本是否在那里.
您还可以通过更改配置选项git config.chage的选择是core.editor.例如:
$ git config core.editor # the current set editor
mate
$ git config core.editor vim # change editor to vim
$ git config core.editor
vim
Run Code Online (Sandbox Code Playgroud)
要使所有存储库中的设置都可用,请添加--global标记git config
$ git config --global core.editor <editor-of-choice>
Run Code Online (Sandbox Code Playgroud)
从git help config联机帮助页:
core.editor
诸如commit和tag之类的命令允许您通过启动编辑器来编辑消息,在设置它时使用此变量的值,并且未设置环境变量GIT_EDITOR.见git-var(1).