I'm using EGit (as provided within the new Eclipse 4.2 Juno release).
I have a repository on GitHub which I have forked from another upstream repository.
When I create a project in Eclipse from the repository on Github, it correctly sets origin
to point to the GitHub repository. But it doesn't yet know anything about the upstream repository (from which I want to merge changes).
I can successfully merge from the upstream repository manually (using "Team / Remote / Fetch From... / Custom URI " and providing the upstream repository details) however it is a bit tedious doing this every time.
However is there any way to tell Eclipse to merge from the upstream repository automatically?
Create a new branch with the branch, switch or checkout commands. Perform a git push with the –set-upstream option to set the remote repo for the new branch. Continue to perform Git commits locally on the new branch. Simply use a git push origin command on subsequent pushes of the new branch to the remote repo.
Select the Remotes node in the git repository view, use create remote, enter "upstream" as name, select configure fetch. In the following dialog you can specify the refspec exactly as you did when you fetched manually.
Afterwards you have 2 entries under Remote and can easily fetch from one by using the context menu on the wanted node.
I don't think Egit supports yet entering remote repo addresses directly within the GUI.
That means you best workaround would be to add that remote (upstream) repo reference manually, with a "git remote add upstream ....
" (as in this example)
Then, you should see that remote reference listed in the "Remotes" node of your "Git repository view":
From there, you should be able to select the right remote, and pull from or push to said remote repo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With