📜 ⬆️ ⬇️

Using different VCS repositories in PhpStorm

Introduction


When deploying projects based on modular applications (for example, Magento), you encounter the fact that the code coexists in a project that resides in different repositories. PhpStorm copes with this situation quite well. Suppose we have a main project located on Github, which uses one new module located there, and one legacy module located in the SVN repository:


Working simultaneously with several git-repositories allows the git submodules mechanism, and PhpStorm also allows you to add to this SVN-repository.


We form the project


We clone the main project, in which there are no submodules yet, to a local disk:
git clone https://github.com/praxigento/z_git_submodules_main.git cd .\z_git_submodules_main #   git submodule add https://github.com/praxigento/z_mage_composer_mod_01.git modules/mod01 

')
Something like this appears in the .gitmodules file:
 [submodule "modules/mod_git"] path = modules/mod_git url = https://github.com/praxigento/z_mage_composer_mod_01.git 


When cloning a main project in which git-submodules are already connected, you need to additionally initiate them:
 git submodule init git submodule update 


Remove submodule
Based on :
 git submodule deinit -f modules/mod01 git rm -f modules/mod01 



Separately connect the SVN-module:
 svn co https://github.com/praxigento/z_mage_composer_mod_02/trunk modules/mod_svn 


You should get something like this file structure:


Setting PhpStorm


Specify in the PhpStrom settings all mount points of repositories in our project:


Work with changes


We make changes to the README files in each of the modules and in the project itself (only three files):


Commit changes to the repository:


For git repositories, push addition changes:


Checking changes in all repositories:


Thus, we are able to commit our changes to several repositories at a time.

Update local code:

Source: https://habr.com/ru/post/246503/


All Articles