Contents

How to update git Submodule after clone parent repository

Problem

Working on repository on another device, I run git clone and clone the sources in parent repository directory(e.g. site in following example directory structure) from gitlab. However, that command does not take submodule content (e.g. what I set in theme/LoveIt).

1
2
3
4
5
6
7
8
9
site
├── .git
│   ├── modules
│   │   └── themes
│   │       └── LoveIt
├── .gitmodule
...
└── themes
    └── LoveIt

Above themes/LoveIt is empty directory.

Confirming .gitmodule has following definition.

.gitmodule

1
2
3
[submodule "themes/LoveIt"]
	path = themes/LoveIt
	url = https://github.com/tatoflam/LoveIt.git

Solution

run git submodule update --init

1
2
$ cd site
$ git submodule update --init

Then submodule is cloned into thema/LoveIt.


Reference