[英]EGit: how to update my branch with other merges
I am using EGit in Eclipse for version controls.我在 Eclipse 中使用 EGit 进行版本控制。
On Github, suppose that I fork a project by clicking the Fork
button to create my own branch.在 Github 上,假设我通过单击
Fork
按钮创建我自己的分支来创建一个项目。 And then, I import the project into Eclipse:然后,我将项目导入 Eclipse:
File --> Import --> Git --> Projects from Git --> Clone URI --> ...文件 --> 导入 --> Git --> 来自 Git 的项目 --> 克隆 URI --> ...
I can then edit the project, commit, and push it as many times as needed.然后,我可以根据需要多次编辑项目、提交和推送它。
After the work is done, I issue a Pull Request
(PR) and the project owner may merge
my branch to the original branch.工作完成后,我发出一个
Pull Request
(PR),项目所有者可以merge
我的分支merge
到原始分支。
If there are also PR's and merges done by other members during my work, how do I get those updates into my project?如果在我的工作期间还有其他成员完成的 PR 和合并,我如何将这些更新添加到我的项目中? Currently, what I do is delete my branch and Eclipse project after my PR,
Fork
the original branch to obtain the newest version, and then import the project into Eclipse, again.目前,我做的是在我的PR之后删除我的分支和Eclipse项目,
Fork
原始分支以获得最新版本,然后再次将项目导入Eclipse。
Is there a standard/better way of doing this in Eclipse?在 Eclipse 中是否有标准/更好的方法来做到这一点? I am thinking about the following procedure:
我正在考虑以下程序:
Fork branch --> Import --> Edit code --> Commit and Push --> Pull Request and merge --> Get stuff from other merges --> Edit code --> Commit and Push ... Fork 分支 --> 导入 --> 编辑代码 --> 提交和推送 --> 拉取请求和合并 -->从其他合并中获取内容--> 编辑代码 --> 提交和推送 ...
In the above, how do I Get stuff from other merges ?在上面,我如何从其他合并中获取内容? Thanks.
谢谢。
Please do not provide command line instructions.请不要提供命令行说明。 I need Eclipse procedures.
我需要Eclipse程序。
Turned out that we need to add one more repository in the Git's config
file, for example, the main
repository:原来我们需要在 Git 的
config
文件中再添加一个仓库,例如main
仓库:
[core]
repositoryformatversion = 0
filemode = true
logallrefupdates = true
[remote "origin"]
url = https://github.com/<myUsername>/blog
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[remote "main"]
url = https://github.com/<mainStreamUsername>/blog
fetch = +refs/heads/*:refs/remotes/origin/*
in which, origin
is my own repository and main
is the main stream repository.其中,
origin
是我自己的仓库, main
是主流仓库。
And then,进而,
Right click project --> Team --> Pull ... (note: choose the one with three dots) --> Remote: choose main
to pull from the main stream project.右键project --> Team --> Pull ...(注意:选择三个点的那个) --> Remote:选择
main
从主流项目中pull。
We can update our branch even by using eclipse IDE.我们甚至可以使用 Eclipse IDE 更新我们的分支。 Follow the steps:
按照步骤:
It will pull the code and give you the updated code.它将提取代码并为您提供更新的代码。
Enter the details of the master branch or the branch from which you want to merge the code输入要合并代码的主分支或分支的详细信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.