Posted on One min read

After I did a clean install of OSX on my laptop I had to clone my blog repository and setup submodules again. This serves as a quick reference should I need to manage submodules again.

GitHub: Working with submodules

Removing

git submodule deinit <asubmodule>    
git rm <asubmodule>
# Note: asubmodule (no trailing slash)
# or, if you want to leave it in your working tree
git rm --cached <asubmodule>
rm -rf .git/modules/<asubmodule>

Stackoverflow reference

Adding

# add entire gh-page repo to public folder
git submodule add -b master git@github.com:<username>/<username>.github.io.git public

# adding a repo to a path
git submodule add git@<github.com or bitbucket etc.>:<repo> <path like lib/billboard>

link to chrisjean

Updating

git submodule update --init --recursive

# or when cloning for the first
git clone --recursive <project url>