Question

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)

Was it helpful?

Solution

When working with Eclipse, I only use egit to actually commit. Everything else I do simply via the command line. The command line in git (or any other VCS) is much more superior and the software was actually created with having the command line in mind, so it's just naturally that you can access really every single feature via the command line.

Everything else only uses the command line in the background and tries to emulate a different interface, native to the host application (here: Eclipse). But by doing that you can never reach the same power as by using the original tools.

However I think when egit develops more, it might be a good way to work with git; similar to how the subversion plugin for Eclipse works well with most functions. But in my situation, I don't use Eclipse for everything and using the command line is then a lot simpler than trying to get used to multiple different plugins and the command line.

OTHER TIPS

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

One way to work out with Egit merge conflict is to take backup of your file, delete it from eclipse, put it back from backup, Add to index and commit.

This should be done only if you can't resolve the conflict with normal Add to Index->Commit method.

PS: I assume you've already resolved the conflict manually or by using Egit merge tool, but just can't remove the conflict marker on the file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top