How do I revert my changes to a git submodule?

I have a git submodule (RestKit) which I have added to my repo.

I accidentally changed some files in there and I'd like to go back to the source version. In order to do that, I tried to run

Mac:app-ios user$ git submodule update RestKit

But as you can see here, this did not work as it is still "modified content":

Mac:app-ios user$ git status
...
#   modified:   RestKit (modified content)

Even

Mac:app-ios user$ git submodule update -f RestKit 

doesn't revert locally modified files.
How do I reset the content of that submodule?


If you want to do this for all submodules, without having to change directories, you can perform

git submodule foreach git reset --hard

You can also use the recursive flag to apply to all submodules:

git submodule foreach --recursive git reset --hard

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.