Git Submodule

git submodule is an interesting way to maintain upstream repositories. Kind of similar to what I have been doing with svn repositories inside a main git repo.

In our git repo, we create a .gitmodules file and declare:

[submodule "local path to where our git sub-repository should exist"]
path = local path to where our git sub-repository should exist
url = git://remote path to our upstream git sub-repository

We can then grab the latest and greatest from this upstream git sub-repository by calling:

git submodule update --init

Nice little trick to maintain modular code and use them for various projects as required.