Git 1.5.3 : submodule
Here’s another new functionality introduce in Git 1.5.3 : submodule.
Submodules allows you to manage subparts of a project in different git repositories and reference them in a “superproject” repository.
You can see it as an equivalent to Subversion “externals”.
A simple usage exemple (in your “superproject” root) :
git submodule add http://mygitdomain.tld/my_sub_project
git submodule init
git submodule update- This will add the remote my_sub_project as an entry in .gitmodules and a directory named my_sub_project in your “superproject”.
- Then initialize all modules added, this means add them to .git/config
- And finally clone and checkout the different modules in their respective directories (created by the
git submodule addcommand)
[Update – 2007/12/05]
I forgot to add you should not work directly with the “superproject” git repository besides adding more submodules.
You should clone the “superproject” git repository first and then the submodule part will be usable.
git clone superproject superprojectcloned
cd superprojectcloned
git submodule init
git submodule updateand work from “superprojectcloned” repository.
Then when you want to include the last versions of the submodules, issue :
git submodule status
git submodule update- status, gives you an overview of the submodules state.
- update, fetch the latest version and reference the sha1 associated.[…]