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.
Prerequisites
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.
Summary
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.
Happy giting:-)
Links
- git: https://git-scm.com/
- NXP MCUXpresso IDE: https://mcuxpresso.nxp.com
- SourceTree client: https://www.sourcetreeapp.com/
Erich, just a warning that I got a spam anti-virus warning take over this page (funny when I’m using an iPad!)
LikeLike
I think it might be because WordPress is doing advertisement on these pages? Other than that, no idea what would be the reason for such a warning 😦
LikeLike
Nice Eric,
As a frequent user of Eclipse as well as a past contributor to the ihateeclipse eebsite, I never reuse a work area, and use Sourcetree to control only required files using git.
I also keep path to work area SHORT.
Sticking with this, Eclipse has not burned me.
Thanks for these tips though.
LikeLike
Yes, I’m using SourceTree too and love it. Still the git plugin functionality inside Eclipse is nice: I see the status of the files and can do diffs/etc too. But I would not use just the Eclipse git functions alone: I highly recommend to use another (external) git client.
LikeLike
Sourcetree is okay, I pay (a tiny amount) for Smartgit which is awesome but have given up even thinking about touching the hell hole that is Eclipse!, VS Code and PlatformIo is brilliant and great git integration as well, I wish chip manufacturers would make sure that their tools could be easily supported in the IDE of your choice. Sure sometimes we need the hardware config but mostly it cane be simpleer and cleaner in json and yaml files and then is far easier to version control. Also allows you to build simple CI/CD pipelines with docker on the platform of your choice,
“Your Choice” is the key here!
LikeLike
Absolutely, the key is to have a choice, and these days everyone can have a choice: from commercial products to open source products up to solutions based on emac or vi :-).
I do see the challenge for chip manufactures, and I feel as long as they provide source code (which they do), it is fairly easy for an experienced developer to use whatever his choice is.
For the ones who do not want to spend a little time to tweak or change things, they still can use whatever the vendor provides which is free-of-charge these days anyway.
LikeLike