Recursively Git Reset All Submodules

git submodule foreach --recursive git reset --hard

This command recursively resets all submodules in a git project. This is especially useful for projects with submodules (and maybe even submodules within submodules) when you want to reset your working copy to a completely clean state.

Nicholas Nadeau, Ph.D., P.Eng.
Nicholas Nadeau, Ph.D., P.Eng.

Nicholas Nadeau empowers teams through fractional CTO services to build next-generation technologies. Subscribe to my newsletter to keep up with the latest trends and explore my services to jumpstart your innovation.