Skip to content

Instantly share code, notes, and snippets.

@da-n
Last active December 15, 2015 10:39
Show Gist options
  • Save da-n/5247737 to your computer and use it in GitHub Desktop.
Save da-n/5247737 to your computer and use it in GitHub Desktop.
Update Git Submodule

Get the submodule initially

$ git submodule add git://github.com/twitter/bootstrap.git lib
$ git submodule init

Time passes, submodule upstream is updated and you now want to update change to the submodule directory

$ cd submodule_dir

Checkout desired branch

$ git checkout master

Update

$ git pull

Back to your project root

$ cd ..

Now the submodules are in the state you want, so

$ git commit -am "Pulled down update to submodule_dir"

Or, if you're a quite busy person:

$ git submodule foreach git pull origin master

- credit: http://stackoverflow.com/a/5828396/695454

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment