Alexander Mills
Alexander Mills

Reputation: 100010

Using GitHub and Eclipse to pull code

I have a repo on GitHub here.

I have pushed to this repo from two different machines, so now one machine is current and another has outdated code. Right now, I am on the machine with outdated code, and I want to pull in the master/HEAD/whatever from GitHub.

And then I get to stare at this:

enter image description here

I do not want to do something stupid like delete the project from Eclipse and then pull in all the code from GitHub.

Can someone please help me merge/synchronize the projects? This is as simple as it sounds.

Unfortunately, this is what happens when I click "Pull" on the above menu:

enter image description here

Would someone also explain what the difference is between Pull, Merge, Fetch and Synchronize?

Upvotes: 4

Views: 44755

Answers (1)

Eugene Ryzhikov
Eugene Ryzhikov

Reputation: 17359

eGit doesn't know, which remote branch you want to pull from. If you create your local branch based on a remote tracking branch, then the key is generated automatically. Otherwise you have to create it yourself:

branch.master.merge=refs/heads/master
branch.master.remote=origin

where master stands for the branchname, in the key it's your local branch, in the value it's the branch in the remote repository. Place that in the repository-specific configuration file %repositorypath%\.git\config

As for the terms:

  • merge: join two or more development histories together
  • fetch: download objects and refs from another repository
  • pull: fetch from and merge with another repository or local branch
  • sync: allows you to compare 2 branches

In general, I urge you to read eGit user guide, where you can get even better understanding of Git and eGit. It can be found at http://wiki.eclipse.org/EGit/User_Guide

Upvotes: 4

Related Questions