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