When I started working with git, I almost immediately had a question - how to work with a project if some of its components are updated frequently. A prime example is the development using Symfony2 . The framework is updated almost every day, you need to constantly “pull up” the code so that it works with the latest version of Symfony2.git clone -b PR3 github.com/symfony/symfony-sandbox.git symfony2sandboxNext, we want the framework to connect as a link. That is, it can be updated independently. There are a lot of advantages in this - the main one is that the project can be divided into independent bundles that are developed and tested independently of the projects that use them. When developing with submodules, you can make it so that different projects will use different versions of bundles. If to speak more simply - projects become small, as if consisting of large bricks, they are easier to maintain.cd src/vendor/symfony/We update the submodulegit checkout -fAfter that, we run unit tests, and ensure that they are all "green."git clone ... [your_project.git]If we now go into the submodule directories, we find that they are empty. To restore a complete project, you need to clone the required versions of the submodules. Go to the root of the project and run the command.git submodule update --initSource: https://habr.com/ru/post/60860/
All Articles