git config --local
选项在哪个 git 版本中可用,我在哪里可以阅读更多相关信息?
我认为不提供 --global
会自动假定它是本地配置变量。为什么需要这个新选项?
最佳答案
由于 git 源代码在 git 中维护,我们可以找到引入 --local
选项的修订版:
commit 57210a678a8bedd222bf4478eeb0a664d9dd5369
Author: Sverre Rabbelier <srabbelier@gmail.com>
Date: 2010-08-03 20:59:23 -0500
config: add --local option
This is a shorthand similar to --system but instead uses
the config file of the current repository.
似乎此更改首次出现在 2010 年底左右发布的 1.7.4 版中。
据我快速查看源代码 (builtin/config.h
) 和手册页可以看出,默认是本地的除非某些环境变量已设置,特别是 $GIT_CONFIG
。 --local
选项显式覆盖任何环境变量设置。
参见 VonC's answer有关 --local
语义的更多信息(在我最初发布此答案后更新了文档)。
关于git - git 什么时候为 git config 命令引入 "--local"开关?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9632794/