Import Projects from git into Eclipse

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.

Import Projects from git

Import Projects from git

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 Git Perspective

Eclipse has a dedicated perspective for git:

Open Perspective

Open Perspective

Open Git Perspective

Open Git Perspective

In that perspective I have a list of repositories and can see the status and commit messages:

Repositiories in Eclipse git Perspective

Repositories in Eclipse git Perspective

💡 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)

File Import Projects from Git

File Import Projects from Git

It asks you if the import shall be from an already existing repository or if a repository shall be cloned first:

Select Repository Source

Select Repository Source

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.

Select Git Repository

Select Git Repository

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:

Source Git Repository

Source Git Repository

Once cloned, I can select the folder to be scanned for the projects:

Source Git Repository

Source Git Repository

💡 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:

Select project folder

Select project folder

Then it scans for existing projects and I can import a list of projects:

Import selected projects from git

Import selected projects from git

Press Finish. With this, I have the project in the Project Explorer listed:

Imported project

Imported project

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

6 thoughts on “Import Projects from git into Eclipse

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

    Like

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

      Like

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

    Like

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

      Like

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.