Import Projects From Git Into Eclipse
In this article, see how to import projects from git into Eclipse.
Join the DZone community and get the full member experience.Join For Free
As a VCS (Version Control System) I’m using git in all my projects. And not only for software or firmware projects: I’m using it for hardware design (KiCAD, FreeCAD, …) or for documentation (LaTeX, …) too.
The nice thing with the Eclipse IDE is that it supports nice git integration, making importing projects from git repositories easy.
In this article I show how I can import projects into Eclipse from a git repository. This is useful if projects are hosted locally or if projects are hosted on a git provider like GitHub or GitLab.
I assume that the following is installed:
- Eclipse IDE, for example the NXP MCUXpresso IDE
- git: https://git-scm.com/
- SSH agent: OpenSSH (or use the agent which comes with the git installation)
Eclipse Git Perspective
Eclipse has a dedicated perspective for git:
In that perspective I have a list of repositories and can see the status and commit messages:
While the Eclipse git perspective is great, I still prefer to have an external git client, and my preference is SourceTree.
Clone Git Repository
For Eclipse I need to have the git repository cloned/present on my machine. I can use normal git operations tools to clone the repository, or I can do this directly from Eclipse using the menu File > Import > Git: (both importers do the same)
It asks you if the import shall be from an already existing repository or if a repository shall be cloned first:
For an existing local repository I can select it from the list. If the desired local repository is not listed, it can be added using the ‘Add…’ button.
If the repository is not cloned yet, I can do this using the ‘Clone URI’ option and then provide the location of the git repository:
Once cloned, I can select the folder to be scanned for the projects:
Cloning a repository might take some time, depending on the size of the repository.
Import From Repository
In a next step I can select the folder of the projects I’m interested in:
Then it scans for existing projects and I can import a list of projects:
Press Finish. With this, I have the project in the Project Explorer listed:
One important and good thing is: it does not copy the projects into the workspace: instead it links to the projects which makes sense for projects under version control.
Importing projects from a git repository is a nice feature in Eclipse, and I can clone the repository as part of the process. Of course, if I have the repository already cloned, can use the MCUXpresso IDE drag & drop feature to import the project too. Beside of that, the built-in git Perspective is very useful too.
Happy git-ing :)
Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.