SaltyCrane Blog — Notes on JavaScript and web development

Git submodule notes

How to add a new git submodule

$ cd /home/saltycrane/path/to/main/project 
$ mkdir -p lib
$ git submodule add git@github.com:saltycrane/another-project.git lib/another-project 
$ git commit -m 'Add another-project git submodule' 

Reference

http://chrisjean.com/2009/04/20/git-submodules-adding-using-removing-and-updating/

How to remove a git submodule

Via Stack Overflow via Git Submodule Tutorial.

    Delete the relevant section from the .gitmodules file.
    Delete the relevant section from .git/config.
    Run git rm --cached path_to_submodule (no trailing slash).
    Commit
    Delete the now untracked submodule files
    rm -rf path_to_submodule

Comments