Git: Sub-Modules
Jump to navigation
Jump to search
Sub Modules are essential in larger projects. It allows for clear division of design, code, testing, and work. This is a crucial feature for good code management.
Contents
Usage
- Set up a sub-module
- Refreshing code from a sub-module
Steps: Setup a sub-module
- Command line
- $ git submodule add git://myserver.com/zend.git lib/Zend
- Create .gitmodules file
- Edit .gitmodules file
[submodule "lib/zend"] url = git@myserver:zend.git path = lib/zend
Populate Sub-Module code
- git submodule init
- This pull down setting. No code updated
- git submodule update
- Pulls down code
Steps: Updating code from Sub-Module
- git submodule -q foreach git pull -q origin master
Deleting a Sub-Modules
- Git has no command line entry to remove a sub-modules
- Removal has to be done manually
Links
- http://git-scm.com/book/en/Git-Tools-Submodules
- https://git.wiki.kernel.org/index.php/GitSubmoduleTutorial
- http://chrisjean.com/2009/04/20/git-submodules-adding-using-removing-and-updating/