Warning: before Git .24 (Q4 2019), using "git submodule foreach git stash" could lost local changes to submodules.
See commit 556895d (12 Oct 2019) by Jakob Jarmar (jarmar).
(Merged by Junio C Hamano -- gitster -- in commit bb52def, 18 Oct 2019)
stash: avoid recursive hard reset on submodules
Signed-off-by: Jakob Jarmar
git stash push does not recursively stash submodules, but if submodule.recurse is set, it may recursively reset --hard them.
Having only the destructive action recurse is likely to be surprising behaviour, and unlikely to be desirable, so the easiest fix should be to ensure that the call to git reset --hard never recurses into submodules.
This matches the behavior of check_changes_tracked_files, which ignores submodules.