git config:“remote.origin.push” vs“push.default” [英] git config: "remote.origin.push" vs "push.default"
问题描述
下面的命令如何:
git config remote.origin.push refs / heads / master:refs / heads / master
与以下命令相关:
git config push.default< option>
(与 - local
或 - 全球
选项)
其中< option>
是以下之一:
nothing
匹配
上游(以前跟踪)
当前
简单
?
I认为我理解第二个配置命令,但我不明白第一个命令是如何涉及第二个命令的。以下是一些提供此问题背景的参考资料:
git push origin ... $ b $ b
无论在 remote.origin.push
中覆盖无论在 push.default
中设置。更一般地说,如果没有设置 remote。 name .push
(这里 name
是 origin
),那么git会回到 push.default
,然后如果这也不是设置,它会回到你的链接中描述的内置默认设置。
请注意:
git config --local na.me value
表示相同没有 - 本地
。当设置值(如这里) - 本地
, - 全局
和 - -file filename
选项控制设置值的位置,但
(提取值时:
git config na.me
[或 git config --get
或 git config --get-all
或 git config --get-regexp
], - local code>等选项限制git读取的地方,没有一个从所有读取它们,如果设置了某些内容,则使用最本地覆盖较少本地不止一个地方。)
How does the following command:
git config remote.origin.push refs/heads/master:refs/heads/master
relate to the following command:
git config push.default <option>
(either with the --local
or --global
option)
where <option>
is one of:
nothing
matching
upstream (formerly tracking)
current
simple
?
I think I understand the second config command, but I don't understand how the first command conditions/relates to the second. Here are some references that provide context behind this question:
- Warning: push.default is unset; its implicit value is changing in Git 2.0
- Default behavior of "git push" without a branch specified
- What's the difference between `git config` and `git push --set-upstream`
When you run:
git push origin ...
whatever is set in remote.origin.push
overrides whatever is set in push.default
. More generally, if remote.name.push
is not set (here name
is origin
), git falls back on push.default
, and then if that is also not set, it falls back on the built-in defaults as described in your links.
Note that:
git config --local na.me value
means the same thing as without --local
. When setting values (as here) the --local
, --global
, and --file filename
options control where the value is set, but --local
is the default.
(When fetching values:
git config na.me
[or git config --get
or git config --get-all
or git config --get-regexp
], the --local
, etc, options restrict where git will read from, and without one it reads from all of them, with the "most local" overriding a "less local" if something is set in more than one place.)
这篇关于git config:“remote.origin.push” vs“push.default”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!