Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring Eclipse / EGit to track an upstream repository

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?

like image 537
mikera Avatar asked Jul 09 '12 15:07

mikera


People also ask

How do I push to upstream repository?

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.


2 Answers

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.

like image 169
Bananeweizen Avatar answered Sep 30 '22 10:09

Bananeweizen


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":

Remotes node

From there, you should be able to select the right remote, and pull from or push to said remote repo.

like image 27
VonC Avatar answered Sep 30 '22 09:09

VonC