多个git编辑器

Mar*_*sen 3 git text-editor

是否可以为不同的git命令配置不同的编辑器?

  • git commit => nano
  • git rebase -i =>崇高的文字

或者是否有一些脚本可以充当中介并分析我执行的命令类型,然后写下我想要的编辑器?

小智 7

您可以使用core.editorsequence.editor设置.core.editor将用于提交,并将sequence.editor用于交互式变基:

git config --global core.editor nano
git config --global sequence.editor <path to sublime text>
Run Code Online (Sandbox Code Playgroud)

官方Linux Kernel Git文档中git config:

core.editor
Run Code Online (Sandbox Code Playgroud)

诸如commit和tag之类的命令允许您通过启动编辑器来编辑消息,在设置它时使用此变量的值,并且未设置环境变量GIT_EDITOR.见git-var(1).

sequence.editor
Run Code Online (Sandbox Code Playgroud)

git rebase -i用于编辑rebase insn文件的文本编辑器.该值在使用时由shell解释.它可以被GIT_SEQUENCE_EDITOR环境变量覆盖.未配置时,将使用默认提交消息编辑器.