Lambdacurry

The correct way to update/change git submodules


  • rm -rf .git/modules/interesting_modules

  • delete the lines containing “[submodule “interesting_modules”] url=”http://something/

  • update .gitmodules

  • run “git submodule sync”

  • run “git submodule init”

  • run “git submodule update” - at this point, a new checkout should happen.

  • new checkout will fail about a version mismatch. This is expected - the version of the submodule stored in the super-project is mismatched. “git status” should also show you “modified” in the submodule directory.

  • “cd interesting_submodule”

  • “git reset —hard HEAD”

  • enjoy !


Lambdacurry

The correct way to update/change git submodules

Published

November 08, 2014

Find me on Twitter @sandeepssrin

Did i make any mistake? Please consider sending a pull request.