waferthin
waferthin

Reputation: 1602

Git version control with multiple projects & users on a single server

Our server is setup to have multiple projects, which are worked on simultaneously by multiple users, located on the same server with each project sharing some source code. The setup is as follows:

We would like to have the source code (shared and project specific) under version control with git (but not the project data due to its size).

Our proposed solution to this is to have a single git repository for all source code (in /src). Then users would checkout the entire repository into the relevant project directory (e.g. /projects/project1) to work on the project (i.e. into /projects/project1/src). This is to avoid changes to any shared source code necessary for a project affecting other users working on other projects on the server. This single repository solution seems to make sense because the project specific code refers to the shared code and should therefore be tracked together. The plan would then be for bug fixes/improvements to be committed back to /src as necessary. At the end of project users can commit a specific version of all source code, so at a later date, this version can be checked out to replicate creation of all data for a specific project using the appropriate version of the project specific and shared source code.

The main disadvantage to this system is that each project directory will contain a copy of the shared source code, plus source code for every other project. However, since the source code is comparatively small, this is not a large overhead in terms of hard drive space

I would be very keen to hear any better solutions to this issue, before we commit to the above plan.

Upvotes: 1

Views: 156

Answers (1)

Cogwheel
Cogwheel

Reputation: 23237

You want separate repos for the shared code and each project. Each project would have the shared code repo as a submodule.

Your tree would look something like:

  • /project1/src - Project 1's "local" source
  • /project1/lib/shared - Submodule of shared repo
  • /project2/src - Project 2's "local" source
  • /project2/lib/shared - Submodule of shared repo

See here for more info about submodules: http://git-scm.com/book/en/Git-Tools-Submodules

Upvotes: 2

Related Questions