DEV Community

Discussion on: How to work with git submodule?

Collapse
 
jingxue profile image
Jing Xue

I'm afraid submodule isn't going to help you avoid creating multiple repositories. It lets you "mount" a subproject from another repo into your main project, which means the subproject still needs to have its own repo to become a submodule.

Collapse
 
ghostbasenji profile image
GhostBasenji

Thanks. How do I do this, and what command should I use?

Collapse
 
jingxue profile image
Jing Xue

I can't think of a git way that does what you want. If you don't want to create multiple repos, and instead want to keep all the projects in one repo, just keep them under the same root directory, and, well, commit them to the same repo.

Thread Thread
 
ghostbasenji profile image
GhostBasenji

In every project, still need to file .gitignore?
Or is one file per repository with multiple projects sufficient?

Thread Thread
 
jingxue profile image
Jing Xue

It really depends on how different your projects are going to be from each other. You can have a .gitignore in each project so that it can be customized specifically for the project. You can also have one .gitignore at the repo root which would be simpler to maintain.

Thread Thread
 
ghostbasenji profile image
GhostBasenji

Yes, the programming language will be the same for all repositories.
Thank you very much.