Git: Commit and push changes from a submodule

A submodule is a repo in another repo.

First, change directory to your submodule directory:

$ cd my_submodule_dir

And check out the master branch (or another branch):

$ git checkout master

Make your changes in your source code.

Then, commit and push your changes:

$ git commit -a -m 'changes in my submodule'
$ git push

An finally, you can commit the changes in your main repo!

$ cd ..
$ git add my_submodule_dir
$ git commit -m "updated my submodule"


That’s all folks!


Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *