how to update one submodule git?

Issue

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.

Solution

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:

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.

Answered By – VonC

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published