Managing Nested Git Repositories in PhpStorm (Working with Nested Projects)

If you have nested projects, for example:

  • C:\projects\ubuntu_24_04\projects\mysite
  • C:\projects\ubuntu_24_04\projects\mysite\www

Both are separate projects in PhpStorm, and you need to store them in Git repositories separately.

If you. e.g. merge branches in Git in the outer project in PhpStorm, the inner project branches will also be merged.

To separate the projects you need to:

1. Add the gitignore to the outer project:

.idea/

www/

2. In the outper project in PhpStorm got to:

  • Go to Settings > Version Control > Directory mappings
  • Click on the inner repo
  • Click the "-" button (Remove) to the remove the repo
  • Uncheck the "Enable automatic mapping detection" checkbox
  • Click the Apply button

The result will be:


Now, when you merge branches in the outer repository, the inner repository will not be affected.

Sergei Korolev
Sergei Korolev
Web developer and the author of all articles on this site. With over 27 years of programming experience, he has specialized in web programming for more than 21 years. He is a Zend Certified Engineer in PHP 5.3 and holds several additional certifications in programming, SEO, web design, UX design, digital marketing, copywriting. You can see his resume here. He is available for remote projects at a rate of $60 USD per hour. You can contact him via this contact form. He currently lives in Belgrade, Serbia.

Leave a Reply

Your email address will not be published. Required fields are marked *