Doing `git reset --hard origin/master` programmatically is almost certainly a bad idea. Phil had something similar in a build script for one of the Meerkat repos and this actually caused me to lose some code that I was working on.

Submodules are repos just like the outer repos, and you can commit directly to them. I do this all the time, in fact, I usually don't keep an "outer" copy of a submodule, so there's no reason to do a programmatic reset.