Search code examples
gitgit-submodules

Multiple GIT projects in a folder


I have a cpp folder with all the libraries and programs ordered like so

cpp/libraries
cpp/programs

cpp/programs/proj1
cpp/programs/proj2
cpp/testing/

Until now, it was quite ok to use one big cpp git, which just had everything in it. However, because I do more than one project at a time at the moment, it has become rather inconvenient to have all the commits to both projects mixed. I've read a lot about submodules, including why they're not so good. My specific case is 100% offline (only pushed to a USB stick for taking it with me).

My ideal solution would be several gits in the subfolders (for projects), which are completely independent, but keeping the "all over" git (for testing and libraries etc), which has the whole cpp folder in it. Much like using .gitignore and just init the ignored subfolders project1 and 2 to be new gits. It is !not! necessary for me to have the libraries in the same git as the projects. But if I start a new one within the current one, I allways get "modifications to untracked files" instead of working directory clean...

Are submodules really a solution to this? Is there some other simple way? As I said, it's a special case, since these are my private/local gits and I just need it to be as simple as can be (no need to be strictly consistent or anything).

I use git as cli tool, and unless there is a huge benefit in a gui thing (mac) I don't really want to change this.

Thanks for suggestions.


Solution

  • I do this routinely for the WIKI repository that is allowed on Github and Bitbucket. Simply ignore the subfolder, and manage the repositories as individual repositories. Not an issue.

    So, I don't use submodules for this purpose.