我如何在Git中获得真正的配置值? [英] How do I get the real config value in Git?
问题描述
似乎 git config
只返回我明确设置的值,并且不知道默认值。例如,当我运行 git config commit.status
时,它不输出任何内容。 $ b http://git-scm.com/docs/git-config 有帮助,但没有列出所有的默认值。
不幸的是,我不认为这是可能的。也许更熟悉git源代码的人会纠正我,但我认为默认值通常在源文件中被硬编码并被配置变量覆盖。例如, gc.pruneExpire
的默认值定义为 here 并有可能被覆盖这里检查配置。我不认为有 git config
的机制可以获得该默认值。
It seems that git config
only returns value that I explicitly set and doesn't aware of the default values. For example when I run git config commit.status
it outputs nothing.
http://git-scm.com/docs/git-config helps but doesn't list all of the default values.
Unfortunately, I don't think this is possible. Perhaps someone more familiar with the git source code will correct me, but I think that the default values are typically hard-coded in the source files and overridden by the config variables. For example, the default for gc.pruneExpire
is defined here and potentially overridden here when the configuration is checked. I don't think there's any mechanism for git config
to get at that default value.
这篇关于我如何在Git中获得真正的配置值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!