How do you do merges using Git, Eclipse and Egit

PaulHurleyuk picture PaulHurleyuk · Mar 25, 2010 · Viewed 21.7k times · Source

I, like many others, love Eclipse as my ide of choice, and because of the way I work (moving about, different places, different projects) want to use Git for CVS.

There is a plugin for Git in Eclipse, Egit, which is now an official Eclipse project, and currently at version 0.7.1. As I've just started using it I'm interested in how others are using it, and what work arounds they are using. Currently Egit doesn't have support for merges, so these have to be done outside of Eclipse and then the workspace refreshed.

So, How do you do this task ? (and any other tasks that Egit doesn't do right now)

Answer

MrCeeJ picture MrCeeJ · Oct 19, 2011

Just for reference, EGIT does now support merges and uses the powerful diff interface within eclipse.

Once you have fetched the code and run a merge, if there are any conflicts they are highlighted in the project explorer with a red !, you can then right click on them and go to Team > Merge Tool, which is un-ghosted for conflicted files.

Once you have selected the code you wish to use (Either the workspace version with diff annotations in it or the HEAD version that caused the conflict) the diff window will open.

This shows your local code on the left and the conflicting code on the right, you can use the 'next difference' button to jump through all the conflicts, and the 'copy change from right to left' button to accept the remote version, or simply edit your local version in place.

Once you are happy with the changes save your file and add it, then commit the results and you should be done.

Please note I am in no way a master of git good practice, so please feel free to correct me if these are not the best operations to use, but it was an answer to the question "How do I do merges in eclipse with egit".