git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: `git submodule update --single-branch` tracks HEAD instead of branch from .gitmodules

From
D. Ben Knoble <ben.knoble@gmail.com>
Date
Nov 20, 2025, 16:05 UTC
Message-ID
<CALnO6CBdc=5KpUwweMzxpT+9CBXZVP4AG4bFS9sGucJJVmzjtQ@mail.gmail.com>
In-Reply-To
<xmkf25oq2vka2kipfqfybngkqffbljqygmtrtiujgsrao7g2wq@k56wxix4oism>

On Mon, Nov 17, 2025 at 4:28 AM Uwe Kleine-König <u.kleine-koenig@baylibre.com> wrote:

Show 29 quoted lines
>
> Hello,
>
> for a project I'm using several submodules, showing my issue with just
> one of them
>
>         $ git ls-tree @:layers | grep poky
>         160000 commit b33a8abe77081a2bdda0d89c61736473b2f9bb8b  poky
>
>         $ cat .gitmodules
>         ...
>         [submodule "yocto_poky"]
>                 path = layers/poky
>                 url = https://git.yoctoproject.org/git/poky
>                 branch = scarthgap
>
>         $ git submodule update --init --checkout --recursive --single-branch
>         ...
>         Cloning into '/home/uwe/work/sri/poet-server/layers/poky'...
>         remote: Enumerating objects: 8775, done.
>         remote: Counting objects: 100% (3119/3119), done.
>         remote: Compressing objects: 100% (158/158), done.
>         remote: Total 8775 (delta 2974), reused 2961 (delta 2961), pack-reused 5656 (from 1)
>         Receiving objects: 100% (8775/8775), 3.24 MiB | 15.45 MiB/s, done.
>         Resolving deltas: 100% (6158/6158), completed with 391 local objects.
>         From https://git.yoctoproject.org/git/poky
>          * branch                      b33a8abe77081a2bdda0d89c61736473b2f9bb8b -> FETCH_HEAD
>
> so far so good. But:
Is it? You've only cloned the HEAD from the origin:
       --single-branch, --no-single-branch
           This option is only valid for the update command. Clone only one
           branch during update: HEAD or one specified by --branch.

Perhaps you want to use --branch here, and _perhaps_ update --single-branch should default to submodule.<name>.branch ?

-- 
D. Ben Knoble
Previous: Uwe Kleine-KönigNext: Uwe Kleine-König
Message 2 of 3 in “`git submodule update --single-branch` tracks HEAD instead of branch from .gitmodules”
  1. Uwe Kleine-KönigNov 17, 2025
  2. D. Ben KnobleNov 20, 2025
  3. Uwe Kleine-KönigNov 21, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.