5

We (5 devs) have been working for years on a project consisting of 2 Netbeans projects:

  1. The core, c++ (1 main dev, 3 supporting, I will be added later on). The core can run on it's own through command line.
  2. The gui, java (just me for now). Calls core functionality through a JNI layer or by invoking executables built from the core.

We've reached a point where we would like to start using version control. No one in the team has any (thorough) experience with that, but I (a complete noob) was assigned to investigate and train the team. I've done a lot of research, set my mind to Git and now I'm trying to figure out the best workflow and infrastructure.

I was thinking of 1 repository for the whole project because we are used to having our version number and release notes in sync, in other words, if either the core or the gui is updated, the whole thing will be released as a new version into production. I imagine having only 1 repository greatly simplifies this.

My question right now: Is it possible to have those 2 separate Netbeans projects inside 1 Git repository and still be able to fully utilize Netbeans' Git support, or are 2 repositories the only course of action?

When using Git only through command line, I don't see any trouble, but using Git (also) through Netbeans is a must for our team and as far as I know, 1 Netbeans project equals 1 Git repository ...

2 Answers 2

7

In short - if you want to have multiple projects inside a single Git repository you need to create and use single local git repository for those projects you want to track together.

For example, you want to have two projects mavenproject1 and mavenproject2 inside one solution repository. To achieve this you need:

  1. Create both projects inside one root directory (solution in our case) enter image description here enter image description here

  2. Choose this directory as the root path while initializing local git repository for the first project enter image description here

  3. After that both projects will show that they have changes to commit

    enter image description here

  4. Sequentially commit both projects to local repository (project->git->commit for each)

  5. Push changes to remote

    enter image description here

  6. Done - you have two projects inside one repo enter image description here

Sign up to request clarification or add additional context in comments.

Comments

2

Git does not care if it is a netbeans project or just a file or a folder. Git just tracks changes to files.

Note that netbeans is just a facilitator. It does not contribute in any way to your business logic. You can as well use any other text editor to edit/modify code and it will work the same way.

So to answer your question:

Is it possible to have those 2 separate Netbeans projects inside 1 Git repository and still be able to fully utilize Netbeans' Git support, or are 2 repositories the only course of action?

Yes. You can have 2 or any number of netbeans projects in a single git repository. But that would be a horrible choice. You will not be able to track versions of each project independently.

You should create a separate git repository for each one of your projects.

2 Comments

Of course using netbeans or any other editor would not pose a problem in itself, but you may have missed a small part of my question. We'd like to use Netbeans' built-in Git functionality. As far as I know, 1 netbeans project equals 1 git repository; that's where my question came from :) Also, the 2 projects are not unrelated. Development is rather independent yes, but the gui cannot really function without the core behind it.
I agree about separate git repo in most cases, but if user has bunch of experimental netbeans projects, and cares not about their future, it is good to keep them in one repo. A good example is when you want that experimental repo to be used from both home, and work, and you want to have up-to-date files there...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.