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 [email protected]:saltycrane/another-project.git lib/another-project 
$ git commit -m 'Add another-project git submodule' 


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).
    Delete the now untracked submodule files
    rm -rf path_to_submodule