• git submodule add <sub-git-url> <sub-repository-path> Adding submodules
  • git submodule foreach git pull [remote-host-name] [remote-branch-name] Update
  • git clone <git-url> --recursive clone the main repository and submodules
  • git submodule init initialize the local configuration file
  • git submodule update check out the commits listed in the parent repository
  • Updating the entire repository
    git pull
    git submodule init && git submodule update // or git submodule update --init --recursive 
    git submodule foreach git pull origin master // When updating code use
    
  • Delete sub-repository (sub-repo)
    git rm --cached sub-repo
    rm -rf sub-repo
    # Delete the .gitmodules file [submodule "sub-repo"] related content
    # Delete .git/config file [submodule "sub-repo"] Related