Kranael
Kranael

Reputation: 73

Folder structure possible in git?

Quick question maybe it is not possible.

I want in github something like a folder that i can group projects based on languages used. So lets say we have 1x java project, 3x python projects, 1x kotlin project and 2x C# projects.

So i want 4 "folders" that contain the repos.

Java folder -> all java repos Python folder -> all python repos

and so on.

Is it possible to build something like that?

I heard of git submodules but thats not really like what I want because the modules are not repos anymore and so commit is not possible.

Thanks for any information in advance :-)

Upvotes: 0

Views: 54

Answers (1)

Dominik Salvet
Dominik Salvet

Reputation: 31

Actually, Git submodules may become standard repositories where further development is possible (and maybe intended to some degree).

Once you clone a repository, which uses submodules, you need to initialize them. You can do it for example using git submodule update --init. Then, as you suspect, your submodules will be checked out to their default commit hash, which is provided by the parent repository.

But the trick is that you can go to a submodule repository inside the parent repository (e.g., cd java) and use Git as normal. So the first thing you will probably do is git checkout java-branch and you are free to do changes. Once committed and pushed, they will appear in the submodule home repository (remote).

Please note that while you are in a submodule repository, you do not modify the history of the parent repository in any way. The only thing that will happen is that the parent repository will detect some changes in a submodule when using git status and committing these changes will change the default commit hash used for that submodule.

Upvotes: 1

Related Questions