We're using git submodules to manage a couple of large projects that have dependencies on many other libraries we've developed. Each library is a separate repo brought into the dependent project as a submodule. During development, we often want to just go grab the latest version of every dependent submodule.
Does git have a built in command to do this? If not, how about a Windows batch file or similar that can do it?
On init running the following command:
from within the git repo directory, works best for me.
This will pull all latest including submodules.
Explained
After this you can just run:
from within the git repo directory, works best for me.
This will pull all latest including submodules.
Explained
Look at http://lists.zerezo.com/git/msg674976.html which introduces a --track parameter
I did this by adapting gahooa's answer above:
Integrate it with a git
[alias]
...If your parent project has something like this in
.gitmodules
:Add something like this inside your .gitconfig
Then to update your submodules, run:
I have an example of it in my environment setup repo.
I don't know since which version of git this is working, but that's what you're searching for:
I use it with
git pull
to update the root repository, too:First time
Clone and Init Submodule
Rest
During development just pull and update submodule
Update Git submodule to latest commit on origin
Preferred way should be below
note: last two commands have same behaviour
If you need to pull stuff for submodules into your submodule repositories use
But this will not checkout proper commits(the ones your master repository points to) in submodules
To checkout proper commits in your submodules you should update them after pulling using