git 在Eclipse中使用EGit推送到远程Git repo时,我应该选择什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10365958/
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
When pushing to remote Git repo using EGit in Eclipse, what should I choose?
提问by qazwsx
What is the
是什么
HEAD
master [branch]
?
?
What should I choose for the "Source ref" and "Destination ref", respectively?
我应该分别为“Source ref”和“Destination ref”选择什么?
采纳答案by VonC
You see this screen in Egit Push URI documentation:
您可以在Egit Push URI 文档中看到此屏幕:
That is where you define the refspecs:
那就是你定义refspecs 的地方:
A "refspec" is used by fetch and push operations to describe the mapping between remote Ref and local Ref.
Semantically they define how local branches or tags are mapped to branches or tags in a remote repository.
In native git they are combined with a colon in the format<src>:<dst>
, preceded by an optional plus sign,+
to denote forced update.
In EGit they can be displayed and also edited in tabular form in the Push Ref Specification and the Fetch Ref Specification and other dialogs.The "left-hand" side of a RefSpec is called source and the "right-hand" side is called destination.
Depending on whether the RefSpec is used for fetch or for push, the semantics of source and destination differ:
For a Push RefSpec, the source denotes a Ref in the source Repository and the destination denotes a Ref in the target Repository.Push Refspecs
A typical example for a Push RefSpec could be
fetch 和 push 操作使用“refspec”来描述远程 Ref 和本地 Ref 之间的映射。
在语义上,它们定义了本地分支或标签如何映射到远程存储库中的分支或标签。
在原生 git 中,它们与格式中的冒号结合<src>:<dst>
,前面是可选的加号,+
以表示强制更新。
在 EGit 中,它们可以在 Push Ref Specification 和 Fetch Ref Specification 和其他对话框中以表格形式显示和编辑。RefSpec 的“左侧”称为源,“右侧”称为目标。
根据 RefSpec 用于获取还是用于推送,源和目标的语义有所不同:
对于推送 RefSpec,源表示源存储库中的 Ref,目标表示目标存储库中的 Ref。推送参考规范
Push RefSpec 的典型示例可能是
HEAD:refs/heads/master
This means that the currently checked out branch (as signified by the
HEAD
Reference, see Git References) will be pushed into the master branch of the remote repository.
这意味着当前签出的分支(由
HEAD
Reference表示,请参阅Git References)将被推送到远程存储库的 master 分支。
回答by jdi
I think you should probably check out a learning guide to understand the terminology of git. Maybe look at this site: http://gitready.com/
我认为您应该查看学习指南以了解 git 的术语。也许看看这个网站:http: //gitready.com/
master
is the default branch of the repo. Usually you consider this your "always working" production branch. Other work can be done in other branches and then merged into the master. "HEAD" is just the most recent changes regardless. In your case here, you would probably push to master (until you figure out branching).
master
是 repo 的默认分支。通常您认为这是您“始终工作”的生产分支。其他工作可以在其他分支中完成,然后合并到master中。不管怎样,“HEAD”只是最近的变化。在您的情况下,您可能会推动掌握(直到您弄清楚分支)。
In a nutshell, while you are learning git, stay on the master branch, and track the remote master branch, and push and pull from the master branch. You will soon discover a ton more amazing features of git as you go.
简而言之,在学习 git 的同时,留在 master 分支上,跟踪远程 master 分支,并从 master 分支推拉。您很快就会发现 git 的更多惊人功能。