Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to organize multiple projects when using git

Tags:

I have 5-10 independent projects that I want place under version control using Git. What is the best way to organize the projects/respositories:

  • Use one repository for each project
  • use one repository for all my work and use subdirectories for each project
  • Or something completely different

What has worked best for you and why?

like image 892
Dug Avatar asked May 20 '09 17:05

Dug


People also ask

Is there a way to put multiple projects in a Git repository?

Yes. You can put multiple projects in one Git repository but they would need to be on different branches within that repo. The Git console in ReadyAPI gives you the ability to create or switch branches from the UI. More information on the Git integration can be found here in the documentation.

How do I manage multiple projects on GitHub?

You can use organizations, meaning one organization by client. Withing an organizations you can create multiple repository and manage permission on a repository and/or organization level. The team plan is probably enough for the need you describe and you can easily include it in the price of your service.


2 Answers

I'd definitely say use one repository for each project. Otherwise you're going to have all sort of crosstalk between projects, not to mention it's a pain to specify long paths if you're using command line git. Git works great with the one repository per project model, I can't really see any reason to use anything else; I don't think I ever really understood why SVN promoted working that way.

like image 146
Marc Charbonneau Avatar answered Oct 03 '22 21:10

Marc Charbonneau


To complete Marc's answer, going with one central repository (with all the projects inside) does not prevent multiple repositories, each with their own project.

Let's hear it from Linus himself:

There are no real issues either way, and perhaps more importantly, it's not even something you have to decide on day one.

You can easily do it one way or the other, and either

  • switch around as needed
  • or even mix the two approaches where it makes sense.

For example, it may be entirely sensible to have the common "distribution points" use a single shared repository that contains all modules as separate branches within the same repository.

But even though such a central distribution point repository is set up that way, individual developers may well decide that they are happier having separate repositories for different modules. The two approaches are not mutually incompatible, and you can fetch data and push it back out between both different kinds of repositories.

like image 41
VonC Avatar answered Oct 03 '22 19:10

VonC