We (5 devs) have been working for years on a project consisting of 2 Netbeans projects:
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 ...
Yes. You can put multiple projects in one Git repository but they would need to be on different branches within that repo.
Solution 2 Create two independent repositories, and push them to the same remote. Just use different branch names for each repo. Thanks a lot, that should be able to solve my problem. Actually, the two solutions use branchs to hold different projects.
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:
Create both projects inside one root directory (solution
in our case)
Choose this directory as the root path while initializing local git repository for the first project
After that both projects will show that they have changes to commit
Sequentially commit both projects to local repository (project->git->commit
for each)
Push changes to remote
Done - you have two projects inside one repo
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With