• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

How do i maintain multiple projects in a tree structure in git ?

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello
I'm used to working with svn , but I wish to convert to git.

I'm used that in svn I work with folders and subfolders

say main folder is Android and under it i will place all my android projects
the next could be Java and under it my java code

but in git there is only the concept of repository, so each project gets a repository

I found in git the concept of submodule, but I do not think it is the same

How do i maintain multiple projects in a tree structure in git?
 
Saloon Keeper
Posts: 28321
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You really shouldn't. Git works on an all-or-nothing basis.

I ran into something like this myself and looked at subprojects, but the whole thing was messy and confusing.

Fortunately these days, disk space is no longer so precious that I absolutely need to pull just part of a project.

If your subprojects are individual Maven or Gradle projects, the easiest way to manage them is to make each subproject an independent git project. That actually maps well to most IDEs, where the subproject is an IDE project.

You can, of course, simulate your SVN setup by naming projects "android-project1", "android-project2", "webapps-chess_app", and the like.

As a consolation, git allows you to quickly easily switch between branches on a project without making a separate branch directory. It has quite a bit of power. Plus the "git stash" feature can be useful if you're working on something and get interrupted.

Note that git only commits and pushes stuff that actually changes, also.
 
yaniv man
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your answer

just to recap if I understand correctly

my choices are

1. adopt a naming convention such as say [programming language]-[customer]-[project name]
2. bundle similar projects under the same repository

just making sure :-)
 
Tim Holloway
Saloon Keeper
Posts: 28321
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah. I refreshed my memory on git sub-repositories and basically there are 3 variants on how to make one repo reference other repos, not how to make a repo that you could download fractionally like in svn.

As far as your own project breakdowns go, I have something similar but this is how I handle it:

I maintain a private Git server for myself and my customers. It runs gitea, which is a fork of gogs. The author of gogs unfortunately hasn't had time to keep the original project up to date, so a group of gogs fans spun off gitea.  You can find docker images of both systems the public Docker services, so if you're a fan of containers, you can get a gogs/gitea server up and running very quickly.

Like github, giteagogs allows multiple user accounts, so when I get a new client, I create an account for their stuff they create user login(s) to that account. Now in my case there are no common resources, o that's all they need. You can use Git's sub-repo features if  you find that manual connections are not sufficient for you.

My projects don't segregate into programming languages, so if I have a multi-lingual project such as an Android app, it's sufficient that I'd have a /src/main/java and /src/main/kotlin in my gradle build. If you're referring to human languages, that comes under I18N, and likewise there are mechanisms for that within a project.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When transitioning from SVN to Git, it’s important to note that Git manages repositories differently. In SVN, you’re used to organizing projects in a folder/subfolder structure, but Git treats each project as a separate repository.

While Git submodules can link repositories within a parent repository, it’s not quite the same as SVN’s folder system. Submodules are designed for cases where projects are dependent on one another (like libraries), and they have their complexities (e.g., version sync between submodules).

If you want to maintain a structure similar to what you had in SVN (like an “Android” folder with subfolders for multiple projects), consider these alternatives:

Multiple Repos in One Directory: Create a parent folder on your local system (e.g., “Android”), and inside it, clone your Git repositories. Each project will have its own repository, but they will still be organized under one parent folder for convenience.

Git Submodules: If you really need to manage multiple projects inside a single repository, you can use Git submodules. Submodules allow you to keep separate Git repositories in specific directories of your main repo. Be aware though, managing submodules can be tricky if you’re not careful with updates.

Monorepo: You could also look into the monorepo approach, where you maintain multiple projects within one large repository. This can be useful if your projects are closely related, but it comes with its own challenges (e.g., scaling, dependency management).

For your use case, simply organizing repositories under a common directory without submodules might be the simplest and cleanest approach.

Let me know if you need any help setting up Git!






yaniv man wrote:Hello
I'm used to working with svn , but I wish to convert to git.

I'm used that in svn I work with folders and subfolders

say main folder is Android and under it i will place all my android projects
the next could be Java and under it my java code

but in git there is only the concept of repository, so each project gets a repository

I found in git the concept of submodule, but I do not think it is the same

How do i maintain multiple projects in a tree structure in git?

 
Willie Smits can speak 40 languages. This tiny ad can speak only one:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic