As mentioned by another user in this answer:
You could add a step which will checkout, from the parent repo, if a submodule has any modified file.
As mentioned in that answer, to checkout you could do:
To undo all changes to your submodule just
cd
into the root directory of your submodule and dogit checkout
.
For the shorter method you could do git submodule foreach --recursive git checkout
.