Created
April 23, 2014 13:00
-
-
Save nicktoumpelis/11214362 to your computer and use it in GitHub Desktop.
Cleans and resets a git repo and its 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
git clean -xfd | |
git submodule foreach --recursive git clean -xfd | |
git reset --hard | |
git submodule foreach --recursive git reset --hard | |
git submodule update --init --recursive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The key for me was
git submodule sync
. Thank you @larsbrinkhoff @yuzhichang!It's a sneaky issue whenever the URLs specified in
.gitmodules
get updated, but the old URLs continue to silently be used (as shown bygit submodule foreach --recursive git remote get-url origin
). Git should honestly warn us whenever the two are different.