使用“--add”或“--replace-all”更改 Git Bash 中的 core.editor

Changing core.editor in Git Bash using "--add" or "--replace-all"

我想我在 Git 中配置编辑器时出错了。 我尝试重新配置,但收到此警告和错误

warning: core.editor has multiple values
error: cannot overwrite multiple values with a single value
       Use a regexp, --add or --replace-all to change core.editor.

如何使用--add--replace-all来改变GitBash中的core.editor?我正在使用 Sublime Text。

错误消息提示了解决方案。如果您阅读 git-config man page,您会看到:

git config [<file-option>] [type] --replace-all name value [value_regex]
[...]
   --replace-all
       Default behavior is to replace at most one line. This replaces all lines
       matching the key (and optionally the value_regex).

所以:

git config --replace-all core.editor myeditor