Multiple PhpStorm projects within a single folder/repository in sub-folders

Answered

Assuming I've a top-level folder which is also the only primary git repository (aka monolith repository)

/uber-project/.git
    subproject1-php/
        app/
        vendor/
    subproject2-nodejs/
        src/
        node_modules/
    subproject3-php/
        app/
        vendor/

When I open /uber-project/ I can access all projects and I can easily use git to switch branches, looks 👍 Every time I do autocomplete on code, I get *everything*. I could imagine I run into other annoyances too (e.g. watcher or other custom stuff overlapping from different projects).

When I open only e.g. /uber-project/subproject1-php/ as PS root, I'm working only in this project and can keep all customizations there in. However, I cannot access git from within PS which is important for me.

Is it possible to have /uber-project/ open in PS but only "view" a single project e.g.  /uber-project/subproject1-php/   so the others don't interfere? I know that way I can use git.

I know I can "ignore" directories but there will be a time where I want to work on /uber-project/subproject2-php/, basically "switch" over. Same also for subproject2-nodejs/

There _may_ be times I want to work on everything, too.

The main motivation here is to unify VCS management. Currently all these projects exist with their own .git project but they are growing and having overlapping parts when it comes to new features or refactoring which is also a pain to manage (a change can lead to 3 PRs in 3 separate projects 💥)

 

Can someone share experience how to work with a structure like this?

2 comments

I think I found out something:

  • you can have a project being primarily in a sub-folder
  • but have VCS root (git) which is "outside"
  • the commit dialog does show also changes "outside" the project

I've to perform testing with this, but this seems to be what I was looking for.

0

Hello,

Yes, this scenario is pretty much valid. Since PhpStorm gets all the information from Git directly, it doesn't matter whether Git root is a level up from current directory as we still can work with our files and paths.

There's https://youtrack.jetbrains.com/issue/IDEA-166884 request that you might want to see implemented - please vote for it with "Thumb up" button.

1

Please sign in to leave a comment.