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

Re: Submodule "git branch" says (HEAD detached at <incorrect-commit>)

From
Julius Smith <jos@ccrma.stanford.edu>
Date
Jul 3, 2019, 08:31 UTC
Message-ID
<CAMPRpjUAKPo-fFeE1R_QjMTrc_RST0y-1Jrhcg2Z-xyH7ubt5A@mail.gmail.com>
In-Reply-To
<CAMPRpjUWBXCEagDB5RwsBTYSJWeypOeY47CGWOO95oZiSCTOjw@mail.gmail.com>
I should add:
> git --version
git version 2.20.1 (Apple Git-117)
On Wed, Jul 3, 2019 at 1:28 AM Julius Smith <jos@ccrma.stanford.edu> wrote:
Show 21 quoted lines
>
> Greetings,
>
> I have a repo with two branches A and B, say, and a submodule pointing
> to a repo also with two branches, say C and D.  Branch A of the parent
> uses branch C of the submodule, while B uses D.  My clone is in a
> state (that I've seen often) where branch A's submodule directory
> _appears_ to be using a commit for D when really it's a commit for C.
> "git branch" in the the submodule directory says "(detached from
> <commit-for-D>)" but this seems to be wrong.  I did "git diff
> <commit>" in the submodule directory to show that it was the C-commit
> and not the D-commit as it appeared.  Could "git branch" in the
> submodule directory be referring to the commit at the time it was
> first detached and not updating after a "git submodule update --init"
> in the parent?
>
> Thanks,
> - Julius
>
> --
> Julius O. Smith III <jos@ccrma.stanford.edu>
Previous: Julius SmithNext: Junio C Hamano
Message 2 of 4 in “Submodule "git branch" says (HEAD detached at <incorrect-commit>)”
  1. Julius SmithJul 3, 2019
  2. Julius SmithJul 3, 2019
  3. Junio C HamanoJul 3, 2019
  4. Julius SmithJul 3, 2019

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.