Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to only update specific git submodules?

So, updating all my submodules is done by running

git submodule foreach 'git pull origin master' 

How do I update a specific submodule, located in say bundle/syntastic, without updating any other submodules?

like image 834
Calvin Cheng Avatar asked May 24 '13 06:05

Calvin Cheng


People also ask

How do I update a specific submodule?

By adding the submodule. <name>. update config setting, you ensure that the selective clone of the submodule will be followed by an update, only for that submodule.

How do I change a submodule to a specific commit?

Use the git submodule update command to set the submodules to the commit specified by the main repository. This means that if you pull in new changes into the submodules, you need to create a new commit in your main repository in order to track the updates of the nested submodules.

How do I ignore changes in git submodules?

If you set ignore = all, to get sane behavior with git commit -a, it will ALSO ignore the submodule in git show/diff when you EXPLICITLY add them. The only way to work-around the latter is using the command line option --ignore-submodule=none.

Can you make changes to a git submodule?

The submodule is just a separate repository. If you want to make changes to it, you should make the changes in its repository and push them like in a regular Git repository (just execute the git commands in the submodule's directory).


2 Answers

I end up there by searching how to update specific submodule only, which means for me, updating a submodule to the ref pointed by its super-repo. Which is not the question nor the answer but only the title.

So in a hope of helping some others like me the answer to the question title is :

git submodule update <specific path to submodule> 

which will put this submodule in the state of the ref commited in the super-repo.

like image 160
antoine Avatar answered Nov 09 '22 12:11

antoine


Actually the proper syntax is:

$ git clone <remote.git> $ cd <remote> $ git submodule update --init -- <specific relative path to submodule> 
like image 28
malat Avatar answered Nov 09 '22 12:11

malat