Skip to content

Git Submodules

Git is a distributed version control system that provided the ability to track source code changes during software development.


Submodules are a way of nesting git repositories. The most common example of this is having a website with plugins where each plugin is it's own git repository. You can work directly in the submodule directory as though it is a normal git repository.

  • Cloning a project that has submodules

    $ git clone --recursive username@hostname:project-name.git -b symfony path_to_folder

    • Update/fetch dependencies
      $ composer update
      $ npm install
  • Updating all submodule changes from upstream

    $ git submodule update --recursive --remote

  • Updating submodules when a new submodule was added upstream
    $ git pull --recurse-submodules origin master
    $ git submodule init
    $ git submodule update --recursive --remote