Tutorial by Examples

You can include another Git repository as a folder within your project, tracked by Git: $ git submodule add https://github.com/jquery/jquery.git You should add and commit the new .gitmodules file; this tells Git what submodules should be cloned when git submodule update is run.
When you clone a repository that uses submodules, you'll need to initialize and update them. $ git clone --recursive https://github.com/username/repo.git This will clone the referenced submodules and place them in the appropriate folders (including submodules within submodules). This is equivale...
A submodule references a specific commit in another repository. To check out the exact state that is referenced for all submodules, run git submodule update --recursive Sometimes instead of using the state that is referenced you want to update to your local checkout to the latest state of that s...
A submodule is always checked out at a specific commit SHA1 (the "gitlink", special entry in the index of the parent repo) But one can request to update that submodule to the latest commit of a branch of the submodule remote repo. Rather than going in each submodule, doing a git checkout...
1.8 You can remove a submodule (e.g. the_submodule) by calling: $ git submodule deinit the_submodule $ git rm the_submodule git submodule deinit the_submodule deletes the_submodules' entry from .git/config. This excludes the_submodule from git submodule update, git submodule sync and git ...
1.8 Run: $ git mv old/path/to/module new/path/to/module 1.8 Edit .gitmodules and change the path of the submodule appropriately, and put it in the index with git add .gitmodules. If needed, create the parent directory of the new location of the submodule (mkdir -p new/path/to). M...

Page 1 of 1