Created
June 13, 2019 21:41
-
-
Save nderjung/4c9ccabc9945c797357796f38403f839 to your computer and use it in GitHub Desktop.
Clean git submodules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Context: you have a number of git submodules and those git repositories | |
# are now dirty with build artifacts. To completely clean the submodules | |
# and reset them to their original clone state, perform the following: | |
git submodule foreach 'git fetch origin; git checkout $(git rev-parse --abbrev-ref HEAD); git reset --hard origin/$(git rev-parse --abbrev-ref HEAD); git submodule update --recursive; git clean -dfx' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment