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

Interactive rebase with submodules

From
JKJohn Keeping <john@metanate.com>
Date
Jan 17, 2012, 18:47 UTC
Message-ID
<4F15C22C.3020902@metanate.com>

I've encountered a scenario where git rebase --interactive drops a commit which contains a modification to a submodule but no other changes.

This occurs when there is a conflict when applying the commit (for example if the submodule's history has been rewritten and you are rewriting the parent repository to match the new version of the submodule).

To clarify:

git rebase -i # Edit a commit, switching submodule to an unrelated commit git rebase --continue # Conflict in submodule, checkout the correct submodule commit git add path/to/submodule # Only change in index is updated submodule git rebase --continue # No commit is created for the submodule change

This appears to be because the git-rebase--interactive script inspects whether there is anything to commit when `rebase --continue` is invoked by running:

     git diff-index --cached --quiet --ignore-submodules HEAD --

Is there a reason for the `--ignore-submodules` in this command? Removing that option results in the expected behaviour.

I can understand not updating submodules while running the rebase, but I expected that having resolved a conflict and added my change to the index it would be applied by `git rebase --continue`, as indeed it is if there happen to be other (non-submodule) changes in the same commit.

-- 
John
Next: Jens Lehmann
Message 1 of 5 in “Interactive rebase with submodules”
  1. John KeepingJan 17, 2012
  2. Jens LehmannJan 17, 2012
  3. John KeepingJan 18, 2012
  4. Jens LehmannJan 18, 2012
  5. John KeepingJan 19, 2012

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.