gpt4 book ai didi

git - 多个 git 编辑器

转载 作者:太空狗 更新时间:2023-10-29 14:30:10 28 4
gpt4 key购买 nike

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

  • git commit => nano
  • git rebase -i => sublime text

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

最佳答案

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

git config --global core.editor nano
git config --global sequence.editor <path to sublime text>

来自official Linux Kernel Git documentation for git config :

core.editor

Commands such as commit and tag that lets you edit messages by launching an editor uses the value of this variable when it is set, and the environment variable GIT_EDITOR is not set. See git-var(1).

sequence.editor

Text editor used by git rebase -i for editing the rebase insn file. The value is meant to be interpreted by the shell when it is used. It can be overridden by the GIT_SEQUENCE_EDITOR environment variable. When not configured the default commit message editor is used instead.

关于git - 多个 git 编辑器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18571741/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com