I am using EGit in Eclipse for version controls.
On Github, suppose that I fork a project by clicking the Fork
button to create my own branch. And then, I import the project into Eclipse:
File --> Import --> Git --> Projects from Git --> Clone 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.
If there are also PR's and merges done by other members during my work, how do I get those updates into my project? 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.
Is there a standard/better way of doing this in 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 ...
In the above, how do I Get stuff from other merges? Thanks.
Please do not provide command line instructions. I need Eclipse procedures.
Turned out that we need to add one more repository in the Git's config
file, for example, the main
repository:
[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.
And then,
Right click project --> Team --> Pull ... (note: choose the one with three dots) --> Remote: choose main
to pull from the main stream project.