尝试将Sublime设置为git中的默认编辑器。
git config --list
返回
core.editor=subl -n -w
push.default=upstream
merge.conflictstyle=diff3
subl .bash_profile
在Sublime中打开该文件
# Enable tab completion
source ~/git-completion.bash
# colors!
green="\[\033[0;32m\]"
blue="\[\033[0;34m\]"
purple="\[\033[0;35m\]"
reset="\[\033[0m\]"
# Change command prompt
source ~/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=1
# '\u' adds the name of the current user to the prompt
# '\$(__git_ps1)' adds git-related stuff
# '\W' adds the name of the current directory
export PS1="$purple\u$green\$(__git_ps1)$blue \W $ $reset"
alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
但是,当我运行git pull origin master
时,它会返回
* branch master -> FETCH_HEAD
hint: Waiting for your editor to close the file... subl -n -w: subl: command not found
error: There was a problem with the editor 'subl -n -w'.
Not committing merge; use 'git commit' to complete the merge.
为什么说命令运行时找不到命令?
编辑:我正在运行macOS Mojave版本10.14.3
答案 0 :(得分:0)
如果通过其完整路径运行Sublime,则也可以为core.editor
提供相同的路径。请尝试以下操作:
git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"