How to update submodules, and with which Git client?
I am currently working with GitKraken.. but it is not friendly to work because you have to open each submodules (one by one) to update 'em and go back git main module and update all submodules.
We are using this workflow (commit, pull and push) for each submodule: is that right?
A Google search did not yield any conclusive answer.
Pulling with submodules. Once you have set up the submodules you can update the repository with fetch/pull like you would normally do. To pull everything including the submodules, use the --recurse-submodules and the --remote parameter in the git pull command .
If you want to check for new work in a submodule, you can go into the directory and run git fetch and git merge the upstream branch to update the local code. Now if you go back into the main project and run git diff --submodule you can see that the submodule was updated and get a list of commits that were added to it.
You can fix it by: either committing or undoing the changes/evolutions within each of your submodules, before going back to the parent repo (where the diff shouldn't report "dirty" files anymore). To undo all changes to your submodule just cd into the root directory of your submodule and do git checkout .
As I illustrated here, the Git command line remains the best (and most complete) option
git config pull.rebase true
git config rebase.autoStash true
git config fetch.recurseSubmodules true
Then, a simple git pull would be enough to update your current branch as well as all the submodules.
Make sure your submodules are tracking a branch, and I have detailed in "", you can do a git submodule update --remote --merge
at any time.
You have also the command git submodule foreach
to execute commands inside submodules.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With