# git submodule of reference with no branch

2 messages from 2025-11-22 to 2025-11-27. Participants: Alon Bar-Lev.
Thread: https://gitlist.dev/t/64520

## Alon Bar-Lev, 2025-11-22 02:13

Subject: git submodule of reference with no branch
Message-ID: <CAOazyz31vWPgGAFv2AHGzXO3MBGnz-EVW_ndPNgERBvRdAFS6A@mail.gmail.com>
URL: https://gitlist.dev/e/CAOazyz31vWPgGAFv2AHGzXO3MBGnz-EVW_ndPNgERBvRdAFS6A%40mail.gmail.com

```
Hello,

I use Gerrit as a code review platform, there are some events in which
I would like to review a feature that touches two repositories, one is
a submodule of the other.

The git module reference is set correctly, but since the change is
under refs/changes/xxx and not under refs/heads/xxx, git cannot find
this reference when trying to check out the repository.

I could not find any option to either have an explicit reference
without a branch or somehow to tweak the configuration to search under
refs/changes instead of refs/heads.

I understand the branch concept makes sense when updating as usually
we are following a repository branch stream, however, I do not
understand what purpose does the branch serve during checkout. The
checkout should be possible based on the reference regardless of the
branch.

Does anyone have an idea if it is possible to have a submodule with a
reference only or tweak git to search a different hierarchy of refs?

Thanks,
Alon

```

## Alon Bar-Lev, 2025-11-27 12:40

Subject: Re: git submodule of reference with no branch
Message-ID: <CAOazyz3f9Ggx88akX8G5LJYzJZxCCp8VZgCPtoM0YCJ8p_UzFg@mail.gmail.com>
URL: https://gitlist.dev/e/CAOazyz3f9Ggx88akX8G5LJYzJZxCCp8VZgCPtoM0YCJ8p_UzFg%40mail.gmail.com
In-Reply-To: <CAOazyz31vWPgGAFv2AHGzXO3MBGnz-EVW_ndPNgERBvRdAFS6A@mail.gmail.com>

```
Hello,

Does anyone have an idea how to handle a submodule reference without a branch?
If this is not supported, will you accept a patch?

Thanks,
Alon

On Sat, 22 Nov 2025 at 04:13, Alon Bar-Lev <alon.barlev@gmail.com> wrote:
>
> Hello,
>
> I use Gerrit as a code review platform, there are some events in which
> I would like to review a feature that touches two repositories, one is
> a submodule of the other.
>
> The git module reference is set correctly, but since the change is
> under refs/changes/xxx and not under refs/heads/xxx, git cannot find
> this reference when trying to check out the repository.
>
> I could not find any option to either have an explicit reference
> without a branch or somehow to tweak the configuration to search under
> refs/changes instead of refs/heads.
>
> I understand the branch concept makes sense when updating as usually
> we are following a repository branch stream, however, I do not
> understand what purpose does the branch serve during checkout. The
> checkout should be possible based on the reference regardless of the
> branch.
>
> Does anyone have an idea if it is possible to have a submodule with a
> reference only or tweak git to search a different hierarchy of refs?
>
> Thanks,
> Alon

```
