Kenny Woo

finding new ways to procrastinate.

github twitter linkedin email rss
Pulling and Removing Git Submodules
Jul 2, 2014
One minute read

Here are a couple operations in git that just aren’t as straight-forward as you’d like.

Pulling Git Submodules

Running git submodule update pulls in new commits onto a detached branch, which may be intended, but seems counterintuitive to what one would expect. If you intend to go into each submodule and run git pull, the following is a way to literally do just that:

git submodule foreach git pull

Removing Git Submodules

  1. Run git submodule deinit asubmodule
  2. Run git rm path/to/asubmodule
  3. Delete the submodule from .git/modules/
  4. Remove entries from .gitmodules
  5. Commit the changes

Back to posts