How do I revert my changes to a git submodule?

A more fail-safe method than all previous answers:

git submodule deinit -f .
git submodule update --init

The first command completely “unbinds” all submodules, the second then makes a fresh checkout of them.
It takes longer than the other methods, but will work whatever the state of your submodules.

Leave a Comment