HCM
HCM

Reputation: 19

Unrelated projects be in the same repo in Git/GitHub?

Can unrelated projects (e.g web development &, say, windows/desktop development) be in the same repository in Git/GitHub?

I may be wrong, as am new to Git, but I see repositories as directories (from the perspective of a regular PC user), hence the need for different directories all residing in the hard drive?

Upvotes: 1

Views: 237

Answers (2)

user483934
user483934

Reputation: 407

Generally, each separate project should have its own repository created. This makes sense when collaborating. Consider a repository with 5 different projects, and different team members working on different projects. Do you think it's necessary for a team member to clone the entire repository of 5 projects just so that they can work on 1, whilst ignoring the other 5?

It's also a better way to show ownership. When looking at a repository, you can view collaborators on that specific repository, and if you have multiple projects in one repository, it gets confusing trying to drill down who collaborated on what project. Furthermore, it even gets difficult when you wish to view, say, change histories on one project in the repository. The history would be polluted with changes to other projects that don't concern you for one particular project. There are also plenty of other reasons why it's not good practice.

You said that you see repositories as directories. This is visually correct to an extent, but remember a repository is so much more than just backing up your data. It shows collaboration, change history, issue tracking, and so much more than a Windows directory wouldn't.

That being said, independent projects can be in the same repository. Git won't complain - you could have one folder for each project in your repository, for example. It's just not good practice :)

Upvotes: 1

Mureinik
Mureinik

Reputation: 310983

A good practice would be to have one repo for one project, but there's no technical limitation on having different projects as different directories in the same git repo. If you particularly want to, there's nothing stopping you having a kernel module, a web interface and a much of cupcake recipes in the same repo.

Upvotes: 0

Related Questions