git Eclipse 中的“Push...”和“Push to upstream...”有什么区别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8762007/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What's the difference between "Push..." and "Push to upstream..." in Eclipse
提问by Florent Paillard
When using "Push to upstream..." in Eclipse, the new "local" commits are pushed to remote repository and the remote branch ref is updated in the local repository (so master
and origin/master
reference the same commit).
在 Eclipse 中使用“推送到上游...”时,新的“本地”提交被推送到远程存储库,并且远程分支引用在本地存储库中更新(因此master
并origin/master
引用相同的提交)。
When using "Push..." and adding a push ref on master in the wizard window (refs/heads/*
), the new "local" commits are pushed to remote repository (like previously) but the remote branch ref is not updated in the local repository (so master
reference the last commit but origin/master
didn't moved).
在向导窗口 ( refs/heads/*
) 中使用“推送...”并在 master 上添加推送引用时,新的“本地”提交被推送到远程存储库(像以前一样)但远程分支引用不会在本地存储库中更新(所以master
参考最后一次提交但origin/master
没有移动)。
What's the difference between these two ways of working? Is it useful for particular decentralized work flows? What would be the corresponding git commands of these two approaches?
这两种工作方式有什么区别?它对特定的分散工作流有用吗?这两种方法对应的 git 命令是什么?
采纳答案by Paul Webster
Push to Upstream.. pushes your branch as you would expect for a remote-tracking branch.
Push to Upstream.. 推送您的分支,就像您对远程跟踪分支所期望的那样。
Push... opens a dialog and lets you specify which refspecs you should push up, including tags, special cases like HEAD:refs/heads/master, etc.
Push... 打开一个对话框,让您指定应该推送哪些 refspecs,包括标签、特殊情况,如 HEAD:refs/heads/master 等。
That it doesn't update origin/master seems like a bug to me, or maybe they're waiting for the next fetch to update origin. I'd open a bug at https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EGit&component=UI
它不更新 origin/master 对我来说似乎是一个错误,或者他们可能正在等待下一次 fetch 来更新 origin。我会在https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EGit&component=UI 上打开一个错误
PW
私服
回答by Florent Paillard
As suggested by Paul, I opened a bugon EGit's Bugzilla and got an explanation there.
按照 Paul 的建议,我在 EGit 的 Bugzilla 上打开了一个错误,并在那里得到了解释。
When "Push..." is used, the EGit PushWizard calls JGit's command with the repositories URIs, not their names. That's why JGit cannot update remote tracking branch.
当使用“Push...”时,EGit PushWizard 使用存储库 URI 而不是它们的名称调用 JGit 的命令。这就是 JGit 无法更新远程跟踪分支的原因。
The bug is still Open so we may hope that in a future release, "Push..." done from a "Configured remote repository" will update remote tracking branch.
该错误仍处于打开状态,因此我们可能希望在未来版本中,从“配置的远程存储库”完成的“推送...”将更新远程跟踪分支。
回答by mike
Push... opens a dialog and lets you specify which refspecs you should push up, including tags, special cases like HEAD:refs/heads/master, etc.
Push... 打开一个对话框,让您指定应该推送哪些 refspecs,包括标签、特殊情况,如 HEAD:refs/heads/master 等。
Extra settings with push are available from either the Git Repositories
or Package Explorer
views, but you must choose the correct option.
从Git Repositories
或Package Explorer
视图中可以使用带有推送的额外设置,但您必须选择正确的选项。
From Git Repositories
view:
从Git Repositories
观点来看:
- Right-click the name of the repo.
- Choose
Push
- Click
Next
- 右键单击存储库的名称。
- 选择
Push
- 点击
Next
OR
或者
- Expand the
Remotes
folder. - Right-click on
origin
- Choose
Configure Push...
- Click the
Advanced
button
- 展开
Remotes
文件夹。 - 右键单击
origin
- 选择
Configure Push...
- 点击
Advanced
按钮
(You can also expand origin
then right-click on Push
and go to Configure Push...
then press the Advanced
button)
(您也可以展开origin
然后右键单击Push
并转到Configure Push...
然后按Advanced
按钮)
From the Package Explorer
view
从Package Explorer
视图
- Right-click on the project folder (top most item).
Team
->Remote
->Push
->Next
(equivalent to pressing the "Advanced" button in the steps above.)
- 右键单击项目文件夹(最上面的项目)。
Team
->Remote
->Push
->Next
(相当于按上述步骤中的“高级”按钮。)
OR
或者
- Right-click on the project folder (top most item).
Team
->Remote
->Configure Push to Upstream...
- 右键单击项目文件夹(最上面的项目)。
Team
->Remote
->Configure Push to Upstream...