# `submodule update --remote` fetches default branch instead of `submodule.*.branch`

1 messages from 2023-04-14 to 2023-04-14. Participants: Nikita Kniazev.
Thread: https://gitlist.dev/t/59600

## Nikita Kniazev, 2023-04-14 23:50

Subject: `submodule update --remote` fetches default branch instead of `submodule.*.branch`
Message-ID: <CAPFiOxax-=PRUBCSOPH=9=UpERQLEJw+pO1Pg+JndM63JyGDAw@mail.gmail.com>
URL: https://gitlist.dev/e/CAPFiOxax-%3DPRUBCSOPH%3D9%3DUpERQLEJw%2BpO1Pg%2BJndM63JyGDAw%40mail.gmail.com

```
Hello,

When I do

  git clone -j10 --depth=1 --branch=develop --no-tags --single-branch
--recurse-submodules --shallow-submodules --remote-submodules
https://github.com/boostorg/boost.git .

Or

  git clone --depth=1 --shallow-submodules --branch=develop
https://github.com/boostorg/boost.git .
  git submodule update --init --remote --checkout --recommend-shallow
--recursive --single-branch --jobs 10 --depth 1

I get the error:

  fatal: Unable to find current origin/develop revision in submodule
path 'libs/callable_traits'

In the trace I see that git clone is called without the
`--branch=develop` even though `git branch` reports `develop` and
`.gitmodules` sets 'branch = .' on every submodule.

  trace: built-in: git submodule--helper clone --require-init --path
libs/callable_traits --name callable_traits --url
https://github.com/boostorg/callable_traits.git --depth=1
--single-branch
  trace: built-in: git clone --no-checkout --depth 1
--separate-git-dir /home/nick/boost-repo/.git/modules/callable_traits
--single-branch -- https://github.com/boostorg/callable_traits.git
/home/nick/boost-repo/libs/callable_traits

I tried different versions:

  git version 2.34.1
  git version 2.39.2.windows.1
  git version 2.40.0.windows.1

```
