Here is my situation:

* I'm working in a repo with 40+ submodules
* `git status` and `git submodule update` take a LONG time (submodule update is several minutes)
* If I checkout a different commit and only a couple submodules have been changed, I can see the submodules that need updating using `git status`, then skip the long wait of a full `git submodule update` by doing

```
git submodule update <submodule path> <submodule path>

```

This will only update the submodules listed, taking only a few seconds

Is there a way to have `git submodule update` only update the modules that actually need it, instead of every one? I don't mind listing out a couple submodules manually, but when there's 6+, it'd be nice for git to somehow use the `git status` result to only run `git submodule update` on the ones that need it.

Does anyone know of any git command tricks I can do to achieve this and speed up my submodule updates? If not, is there a trick I can use to make a bash script to extract the necessary information from `git status` and build & run a `git submodule update <> <> <>` command for me?

Bonus: is there a way to achieve a similar result on submodules that have had their content modified? That is, the submodule needs to be `git reset --hard HEAD`, not checked out to a new commit. But doing this without entering EVERY submodule, such as `git submodule foreach git reset --hard HEAD`, only ones that need it?

Example `git status --porcelain`

```
$ git status --porcelain
 M ABC
 M XYZ
 M XXX
 M YYY
 M FOO/BAR

```