简体   繁体   English

EGit:如何使用其他合并更新我的分支

[英]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:按照步骤:

    1. Right click on the project in which changes have been done.右键单击已完成更改的项目。
    1. Select "Team"选择“团队”
    1. Select "Pull..."选择“拉...”
    1. Click on "New Remote"点击“新建遥控器”
    1. Click on Finish.单击完成。

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.

相关问题 如何在eclipse中使用EGIT仅将特定文件从一个分支更新到另一个分支? - How to update only a particular file from one branch to the other using EGIT in eclipse? 如何使用Git,Eclipse和Egit进行合并 - How do you do merges using Git, Eclipse and Egit Eclipse egit:如何使远程分支成为本地 - Eclipse egit: How to make remote branch local 如何在Egit中将当前分支更改为master? - How to change the current branch to master in Egit? 如何将代码从eGit的主服务器中提取到Eclipse IDE中的本地分支? - How to pull code from the master in eGit to my local branch in eclipse IDE? 如何使用EGIT删除远程存储库中的分支? - How to delete a branch in the remote repository using EGIT? 如何在EGit for Eclipse中显示不同分支的历史记录? - How to show history of different branch in EGit for Eclipse? 如何使用egit / eclipse配置工作区,以便我的更改进入fork分支 - How to configure workspace with egit/eclipse so my changes go to branch on fork 如何使用egit将分支A的PART提交合并到分支B? - How to merge PART commits of branch A to branch B with egit? 如何使用 Eclipse EGit 从我的服务器 git 存储库下载/克隆一个新分支到我 PC 中已经创建的本地 git 存储库 - How to download/clone a new branch from my server git repository into an already created local git repository in my PC with Eclipse EGit
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM