3

I have read the discussion between multiple projects per repo and one project per repo:

  1. What's the best practice for putting multiple projects in a git repository?
  2. https://softwareengineering.stackexchange.com/questions/161293/choosing-between-single-or-multiple-projects-in-a-git-repository

What I want to understand is how should we manage multiple projects in one Git repo?

Could anyone point me to any public repos which do this currently or provide me with the best practices (the first link above mentions about orphan branches but I wanted to see if there are other ways) or tutorials to achieve this?

Community
  • 1
  • 1
takeradi
  • 3,661
  • 7
  • 29
  • 53
  • aren't submodules separate repos that you import into your own repo for use? https://git-scm.com/book/en/v2/Git-Tools-Submodules wouldn't that mean that you are saying to implement one project per repo and then import the projects required by other projects as submodules? – takeradi Jan 10 '16 at 18:22
  • Well, yes and no. Your super-repository sees it's submodules (each one being a either another super-repository, or a repository) as files. When head pointer changes in one submodule, owning super-repository reports a changed file. (see `git stat` in a super-repository) – sorush-r Jan 10 '16 at 18:26

1 Answers1

8

Do you put code for each app in separate source control repositories or do they live in a single repository?

What is the usual practice?

They should be in a single repository each.

You can use submodules for this purpose.

Submodule is a project inside project. The benefits of submodules is that it will allow you to have project within another project.

Git-Tools-Submodules
git-tip-of-week-git-submodules

enter image description here

Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167