Git: multiple projects with single repository


maybe it's a silly question, I just started using versioning systems...

I've multiple projects in my local "htdocs" root, containing several projects each having some common PHP scripts (and relative paths) inside them (in various versions, depending on age)

I've searched here (and googled a lot) to understand if the following is possible:

is it possible to setup a local git (or other CVS), to keep some of the files, stored in (same named) local paths among multiple project, under version control?

I mean, having the single scripts in single projects versioned, to avoid copying them back and forth among the projects to keep them updated?

thank you very much for any help ;)


Comment actions Permalink

Hi there,

1. Well .. every project can have more than one VCS (not on per file .. but on per folder basis) -- "Settings | Version Control".

If such special files are stored in separate sub folder, then you can easily assign different VCS/repository for that folder.

This means that you will have to configure such additional VCS root in every project where those files will be used.

2. Have you thought about symbolic links? Any modern OS supports them. Obviously, no versioning in such case (unless done via manual backups or whatever)

Comment actions Permalink

thanks! ;)

1] I've tried to put a repository at the root of all projects, but (of course) having different paths the same files are seen as different ones... will try making multiple repositories as you suggest

2] Yes i know, but before using the same file/library on different projects I prefer to be sure no compatibility issues emerge, and I'd like to be able to (temporary) revert to previous versions

thank you very much for your help

Comment actions Permalink

I think I found what i'd need...

subtrees (submodules?)... never used them so i've to dig some documentation and verify it's possible to integrate this strategy in phpStorm


Comment actions Permalink

thamk you!

I'll go to read asap :)

Please sign in to leave a comment.