git - 推动电流与推动上游(跟踪) [英] git - push current vs. push upstream (tracking)
问题描述
我读过关于push命令的git man,但我仍然不明白当前和上游之间的明显区别, .default
我希望我们的团队只会推送,并且只会改变他们当前正在处理的分支,将会被推送。
据我所知,当我做 git分支时,这个分支是标有*(星号)的那个分支。
帮助。
问题在于您正在推送什么, / em>: 正如这里解释过的,Git2.0会另外引入一个新的默认值 仅推送一个分支模式 两者之间的差异( 按 I have read the git man about push command, but I still don't understand the EXACT difference between current and upstream to be set in the push.default I want that our team will just do push, and only changes on the branch that they are currently working on, will be pushed.
As I understand, this branch is the one that marked with * (star) when I do git branch. Thanks for helping out. The question is what are you pushing, and to where: As explained here, Git2.0 will additionally introduce a new default for Pushing only one branch (with the mode "
The difference between the two ( pushing " pushing " 这篇关于git - 推动电流与推动上游(跟踪)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
当前
:
$ b
什么也只是当前分支,
push.default
: 简单
$ b 简单
就像 上游
,但上游必须具有相同的名称,否则推送将失败。
简单
,当前
或上游
)避免场景,其中所有匹配分支被推送(模式匹配
,这是很长一段时间的默认值),即使你的一些分支可能没有准备好被推送。
(主)> git push
...
到git@github.com:jkubicek / my_proj.git
21b430d..dd378ca master - >掌握
! [被拒绝]发布 - >发布(非快速转发)
错误:未能将某些引用推送到'git@github.com:jkubicek / my_proj.git'
提示:更新被拒绝,因为推送的分支提示位于其后远程
提示:对应。
提示:如果您不打算推送该分支,则可能需要
提示:指定分支以推送或设置'push.default'配置
hint:variable为'current'或'上游'仅推送当前分支。
current
和 upstream
)在 pull 中(从远程连接到你的分支)
当前
并不意味着您当前的分支 B
具有远程/ B
具有其上游分支。
Ie:当您推送
。当前
分支时,没有设置> branch.B.gege
Ie:当拉到 B
时,git将不知道要拉什么分支。 upstream
表示您当前的分支 B
有 remote / B
has它的上游分支。
Ie: branch.B.merge
是设置的,当你推动 upstream
分支。
即:拉到 B
时,git知道要拉什么分支作为哪个远程回购: branch.B.remote
)
current
:
upstream
:
push.default
: simple
simple
is like upstream
, but the upstream has to have the same name as well or the push will fail.
simple
", "current
" or "upstream
") avoids the scenario where all matching branches are pushed (mode "matching
", which was the default for a long time), even though some of your branches might not be ready to be pushed.(master)> git push
...
To git@github.com:jkubicek/my_proj.git
21b430d..dd378ca master -> master
! [rejected] release -> release (non-fast-forward)
error: failed to push some refs to 'git@github.com:jkubicek/my_proj.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart.
hint: If you did not intend to push that branch, you may want to
hint: specify branches to push or set the 'push.default' configuration
hint: variable to 'current' or 'upstream' to push only the current branch.
current
and upstream
) is in the pull (what to pull from the remote to your branch?):
current
" doesn't mean that your current branch B
has remote/B
has its upstream branch.
Ie: branch.B.merge
isn't set, when your are pushing the "current
" branch.
Ie: when pulling to B
, git won't know what branch to pull.upstream
" means that your current branch B
has remote/B
has its upstream branch.
Ie: branch.B.merge
is set, when your are pushing the "upstream
" branch.
Ie: when pulling to B
, git knows what branch to pull (as well as which remote repo: branch.B.remote
)