What is GIT ?

Topics: tools, development

Author: Maitrik


GIT Submodule

Adding a Submodule to a Repository

git submodule add <url> <destination>

Submodule Basic commands

git submodule status
git submodule init
git submodule update

Update Submodule URLs

git submodule sync

Remove a submodule

git submodule deinit <submodule location>
git rm -rf <submodule location>

Clone submodule in a cloned repository

git submodule update --remote
git submodule update --init --recursive

Update all submodules

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

Edit a submodule

cd components/canvasrunner
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