Here's another quick set of notes for myself for posterity. I always clone and build a project on the command line before I import it into the IDE to begin hacking code. Right now I have to handle a hairy merge so I need a visual tool to make things a bit easier. For this purpose, I want to make Eclipse git aware so that I can use the visual diff in the IDE. Hopefully these notes will help out someone else, too.
For this situation I'm dealing with a Java project that uses git. First some quick items to set the stage:
- IDE:For Java development, my IDE of choice is the SpringSource Tool Suite (STS). If you develop Spring-based Java apps and you like Eclipse, you should really be using STS.
- SCM: The majority of projects I have worked with over the last few years use git for SCM. It is vastly superior to any other SCM tools I've used and documentation abounds for it, but it is a bit like a razor blade.
- IDE+SCM: The standard git tool for Eclipse is EGit
To make the Eclipse project git aware, follow these steps:
- Go to Window->Show View->Other
- In the filter field, enter the word git
- Select Git Repositories and click OK
- Click on the icon whose tooltip reads 'Add an existing local Git Repository to this view'
- Click on the browse button and navigate to the directory that contains the project source code
- Click the Search button
- Click OK
- Right-click on the project in the Package Explorer
- Go to Team->Share Project
- Select Git and click Next
- Check the box for 'Use or create Repository in parent folder of project - this should automatically find the .git directories
- Click Finish and let EGit complete the integration
After following these steps, the projects should be connected to their git repository. This allows you to handle the vast majority of git commands right from inside the IDE.
For more info about EGit, check out the EGit User Guide.