# git submodule problem

1 messages from 2021-03-30 to 2021-03-30. Participants: Erik Claij.
Thread: https://gitlist.dev/t/55412

## Erik Claij, 2021-03-30 09:09

Subject: git submodule problem
Message-ID: <dab7128d-5ea7-5d7c-1ae1-1d71be316326@gmail.com>
URL: https://gitlist.dev/e/dab7128d-5ea7-5d7c-1ae1-1d71be316326%40gmail.com

```
Dear git,

Changing branch with

     git checkout --recurse-submodules <branch>

does not work when the branch does contain a new submodule.

Cloning a repo without submodules in master but submodules in the 
<branch> will reproduce this problem.

Error

     fatal: not a git repository: 
../../.git/modules/module/esp32_peripherals
     fatal: could not reset submodule index

The alternative way does work

     git checkout <branch>
     git submodule update --init --recurse
     git clean -ffd

Best,

Erik Claij


```
