Using Git with Eclipse for DS-5
A source control system (SCS) allows you to version your source files and share them with other developers. There are many source control systems available, both commercial and open source. This tutorial explains how to integrate the open source Git source control system into Eclipse for DS-5. It assumes you are already familiar with the basic concepts of using Git.
Eclipse for DS-5 does not come with Git integration as standard, but this can be easily added afterwards. The EGit project provides Git integration into Eclipse.
To install the EGit plugins
- Select Install New Software... from the Help menu in Eclipse.
- Click the Add button, and enter the EGit update site URL, http://download.eclipse.org/egit/updates, into the Location field, and provide a suitable Name. Click OK.
- The Install dialog refreshes to list the available EGit plug-ins. Select the plug-ins named "EGit Team Provider" and "JGit". The "EGit Team Provider - experimental features (incubation)" plug-in is optional, and you can either expand the option or refer to the EGit website for further information on exactly what this provides.
- Click Next and review the plug-ins to be installed.
- Click Next and review and accept the plug-in license agreements.
- Click Finish. Installation of the plug-ins commences and might take a few minutes to complete.
- You might receive a warning during installation that the plug-ins are unsigned. Click OK to dismiss this warning.
- At the end of installation you are prompted to restart Eclipse. It is recommended that you select Yes to restart Eclipse. Restarting ensures that the plug-ins are correctly initialized.
With EGit installed and configured you can now use it to manage your source projects. The following provides a summary of the features available:
- Configuration: You can review and change the settings for EGit by selecting Preferences from the Window menu, and then navigating to the Team > Git section in the tree.
- Create a new local repository: Select New > Other... from the File menu, choose Git > Git Repository from the dialog, and then click Next. Enter the path for the new repository and click Finish. The new repository is created, and you must then import the repository if you want to access it from within Eclipse.
- Import projects from git: Select Import from the File menu, and choose Git > Projects from Git from the dialog. Then follow through the dialog, adding either a local repository or a remote repository via a URI. You will be prompted to either import an existing Eclipse project from the repository or to create a new project. After import, the project is accessible in the Project Explorer view.
- Checkout existing projects from git: If you have an existing project in git you can check it out by selecting Import from the File menu, and then choosing the SVN > Checkout projects from SVN option.
- Manage git projects: Assuming you have a project in Eclipse that is stored in git, then you can update, review changes, revert changes and check-in from within the IDE. To do this, navigate to your project in the Project Explorer view and right-click on the project, a folder or a file, as appropriate, and use the Team menu to perform any source control operations.
- Browse git repositories: A separate Eclipse perspective is provided to allow browsing an entire git repository. To do this, select Open Perspective > Other... from the Window menu, choose the Git perspective and click OK. In the Git Repositories view you can register git repositories and browse their contents.
You can find lots more help on the EGit website or in the documentation that is installed into Eclipse by the EGit plug-ins.