Git: Why Updating Submodules Rewinds Change

When you run git submodule update --remote in a container repo, you might notice that it says:

Submodule funny_module bf722acd..02dc481d (rewind):
  < That awful bugfix

Why the rewind?!

This is because:

This command will by default assume that you want to update the checkout to the master branch of the submodule repository.

You can, however, set this to something different if you want. For example, if you want to have the DbConnector submodule track that repository’s “stable” branch, you can set it in either your .gitmodules file (so everyone else also tracks it), or just in your local .git/config file.

So only run this command in your container after your submodule change is stable and merged into the default branch.

Git submodules are so tricky. :/


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.