Skip to content

Instantly share code, notes, and snippets.

@u840903
Last active April 22, 2022 14:40
Show Gist options
  • Save u840903/11253187 to your computer and use it in GitHub Desktop.
Save u840903/11253187 to your computer and use it in GitHub Desktop.
Github Submodule Cheat Sheet

Add a submodule

git submodule add https://github.com/janjarfalk/canvasrunner.git components/canvasrunner/

Update all submodules

git submodule foreach git pull origin master
cd ..
git commit . -m "Updated submodules"
git push

Remove a submodule

git submodule deinit components/canvasrunner    
git rm components/canvasrunner

Edit a submodule

cd components/canvasrunner
<edit>
git commit . -m "Edited"
git push
cd ...
git commit . -m "bumped canvasrunner"
git push

Clone repositories with submodules

git clone --recursive

Pull submodule if you forgot to clone --recursive

cd components/canvasrunner
git submodule update --init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment