git submodule usage

Update: Looks like subtrees are a nicer alternative to submodules. Anyway..

  • To update all submodules:
git submodule update --init --recursive
  • To fetch the latest code from a submodule:
    cd <submodule-folder>
    git pull
    cd ..
    git commit -am "bumping up submodule version"

Then merge the code. The next time the parent repository is pulled, updating the submodule will get the latest commit in it.

Leave a Reply