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

Re: fatal: cannot rebase with locally recorded submodule modifications

From
Shourya Shukla <shouryashukla.oo@gmail.com>
Date
Feb 7, 2020, 22:04 UTC
Message-ID
<20200207220403.28961-1-shouryashukla.oo@gmail.com>
In-Reply-To
<660c39af-d0f2-5e4c-66a0-5c78b646b023@free.fr>
Hello Brice,

The error you are facing here is actually a bug in the 'git pull' command[1]. When one tries to use the '--recurse-submodules' tag with the command, it tends to fail.

> Why is failing here?

Going into a bit detail of 'git pull', the command actually is a combination of 'git fetch' and 'git merge'(unless any other tag is specified i.e. 'rebase' here which would mean a fetch followed by a rebase). Quoting from the documentation:

> Using --recurse-submodules can only fetch new commits in already
checked out submodules right now

Using the '--recurse-submodules' tag will try merging/rebasing any changes(updations, additions, deletions, etc.) made to the fetched submodule(s) from upstream, i.e. the _un-checked out_ submodules into our local repository which will cause the error to be thrown as it is not supported right now. This will therefore create the detached HEAD just like the one you obtained.

The "workaround" is to do a 'git fetch' and then merge again after the 'git pull <tag> --recurse-submodules'.

The presence/absence of 'git reset --hard' before the pull won't create any difference to this error in my opinion.

Regards, Shourya Shukla

[1]: https://git-scm.com/docs/git-pull#_bugs
Previous: Brice GoglinNext: Philippe Blain
Message 2 of 4 in “fatal: cannot rebase with locally recorded submodule modifications”
  1. Brice GoglinFeb 7, 2020
  2. Shourya ShuklaFeb 7, 2020
  3. Philippe BlainNov 14, 2020
  4. Philippe BlainNov 13, 2020

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.