Aller au contenu

submodule

Git submodule allows ro add externel repository in a repository

Adding submodule

  • git submodule add http://git/toto.git $path this command add http://git/toto.git in path directory (add -b $branchname to follow specific branch)
  • after that you need to add and commit submodule folder

to populate a submodule nested in other submodule

  • git submodule init
  • git submodule update

removing submodule

  • remove submodule entry in .gitmodules
  • remove submodule entry in .git/config (only present when git submodule init have been perform)
  • remove submodule path git rm --cached $path

Updating submodule

you can update a submodule Manually going in submodule folder and perform a git fetch and git merge

Fetch and merge

automatic process - perform a git submodule update --remote

in each case you need to commit update in project