Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should you have one Git repository or several when you have a project with web/ios/android applications?

Tags:

git

In terms of organizing a new project, what are the pros/cons of having one Git repository with subdirectories for web/ios/android/etc versus having independent repositories for each?

Any recommendations?

like image 696
ckarbass Avatar asked Dec 25 '11 17:12

ckarbass


People also ask

Should I have multiple Git repositories?

You should use multiple Git repositories if your codebase is too large to maintain in a single Git repository. Git can't scale to handle 10s of thousands of users or 100s of petabytes of data in one repository. Using a monorepo works well if you use ClearCase, SVN, or Perforce Helix Core.

Should each project have its own repository?

If your projects are independent, it's fine to keep them in separate repositories. If they share components, then put them together.

When should I use multiple repositories?

A multi repo can better support granular access control and configuration changes. If you have a large team that collaborates on a complex infrastructure system, multiple source repositories allow you to localize changes and lessen the blast radius of failed infrastructure updates across the system.

Can a Git project have multiple repositories?

If you are working on a big project, then it is inevitable that you need to work with multiple repositories. That's why you need to sync your local code base with multiple Git remote repositories.


1 Answers

Git doesn't provide easy way to checkout sub-directory from a repository. That means if you have two teams working on android and ios version respectively every one of them will have to checkout code of the other team.

What's worse git log will be a complete mess as it'll contain commits from all of the applications. That might cause some troubles while creating and merging branches related to particular application as well.

I don't see any good reason for having separate projects in the same git repository.

If you want to have some central repository where you can store additional stuff like docs or smth else that is related to the whole project and not one of the application you can create central repository and add repository of each application to it as git submodule.

like image 84
KL-7 Avatar answered Nov 15 '22 15:11

KL-7