13

I have a couple of submodules and I only want to update one of them.

I think this command updates all of them in .gitmodules

git submodule update --init --recursive --remote

I just want one of the modules updated though.

VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755
Thomas Mccaffery
  • 305
  • 2
  • 3
  • 10
  • Do you want to update a submodule to the latest commit? See here: https://stackoverflow.com/questions/5828324/update-git-submodule-to-latest-commit-on-origin – Tim Biegeleisen Jul 22 '17 at 06:20

1 Answers1

21

The git submodule update command takes a path as a parameter.

Use the path of the submodule you want to update, as said path is recorded in your .gitmodules.

git submodule update --init --remote a/submodule/path

Make sure your submodule follows a branch first.

For a manual update, you also can go into the submodule folder, and do a git checkout aBranch/git pull yourself. Then go back to the parent repo, add and commit the new gitlink SHA1 for that submodule.

kayleeFrye_onDeck
  • 6,155
  • 5
  • 66
  • 74
VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755