Reset all git submodules

June 10, 2016

Here is a quick snippet that will reset all your git submodules to their most recent commit. Handy when something has happened such as a file permissions change that unintentionally affected the submodules.

git submodule foreach --recursive git reset --hard

One thought on “Reset all git submodules

  1. (August 1, 2020)

    git submodule foreach git reset –hard HEAD git submodule update git submodule foreach “git checkout master; git pull” git submodule foreach git clean -f

Leave a Reply

Your email address will not be published. Required fields are marked *