Configuring Eclipse / EGit to track an upstream repository

萝らか妹 提交于 2019-12-07 03:44:58

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/11398658/configuring-eclipse-egit-to-track-an-upstream-repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!