meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
git:sub [2016/09/07 07:31] – created niziakgit:sub [2019/01/07 13:05] (current) niziak
Line 1: Line 1:
 +https://andrey.nering.com.br/2016/git-submodules-vs-subtrees/
 +
 ====== submodules ====== ====== submodules ======
 +Submodule is only a link to commit ref in another repo.
  
 +=== Add ===
 +Adding submodule:
 <code bash> <code bash>
-git submodule update --init --recursive +git submodule add <repository> [<relative_local_path>]
-git fetch --recurse-submodules+
 </code> </code>
  
-Adding submodule:+=== Init === 
 +After cloning master repo with submodules:
 <code bash> <code bash>
-git submodule add <repository> [<relative_local_path>]+git submodule init 
 +git submodule update
 </code> </code>
 +
 +alternatively repo can be clonned with 
 +<code bash>
 +git clone --recursive <url>
 +</code>
 +
 +
 +<code bash>
 +git submodule update --init --recursive
 +git fetch --recurse-submodules
 +</code>
 +
 +
 +
 +
 +=== Remove ===
  
 Removing submodule: Removing submodule:
-  * remove entry in .gitmodules +  * <code bash>git submodule deinit lib/lib_to_be_deleted</code> 
-  * remove entry in .git/config +  * remove entry in ''.gitmodules'' 
-  * remove dir: git rm --cached lib/lib_to_be_deleted+  * stage ''.gitmodules'' 
 +  * ? remove entry in ''.git/config'' 
 +  * remove dir: ''git rm --cached lib/lib_to_be_deleted'' 
 +  * remove module content: ''rm -rf .git/modules/lib_to_be_deleted''