Update Submodules with Git
Git submodules seem to confuse people and I can probably count myself in that group of people that are confused. Their code is kind of part of the codebase, kind of isn't. Pulling the latest code from the overall project doesn't pull the updated submodule code, so sometimes you get errors and don't know what's going on. To ensure your submodules are always up to date, run this via the command line:
git submodule update --init --recursive
This command ensure your existing submodules are current as well as adds new submodule code whenever appropriate. I like to run this at least once a day just to make sure my code is always up to date. You never know what some of your collaborators have contributed (if you work in a team setting), so running this daily is useful!
![9 Mind-Blowing WebGL Demos]()
As much as developers now loathe Flash, we're still playing a bit of catch up to natively duplicate the animation capabilities that Adobe's old technology provided us. Of course we have canvas, an awesome technology, one which I highlighted 9 mind-blowing demos. Another technology available...
![Create a Sheen Logo Effect with CSS]()
I was inspired when I first saw Addy Osmani's original ShineTime blog post. The hover sheen effect is simple but awesome. When I started my blog redesign, I really wanted to use a sheen effect with my logo. Using two HTML elements and...
![dat.gui: Exceptional JavaScript Interface Controller]()
We all love trusted JavaScript frameworks like MooTools, jQuery, and Dojo, but there's a big push toward using focused micro-frameworks for smaller purposes. Of course, there are positives and negatives to using them. Positives include smaller JS footprint (especially good for mobile) and less cruft, negatives...
![Create a Dojo Lightbox with dojox.image.Lightbox]()
One of the reasons I love the Dojo Toolkit is that it seems to have everything. No scouring for a plugin from this site and then another plugin from that site to build my application. Buried within the expansive dojox
namespace of Dojo is
While this is definitely a useful command, it’s worth noting that updating your submodules basically just checks out the revision as defined in the repository. If you’re maintaining a project that uses submodules, this won’t get the latest code for that submodule, so much as it just ensures that the submodule is on the commit as defined.
For example, I maintain all of my dotfiles in a Git repository, which includes several submodules (Vim plugins, mostly). This command doesn’t actually update the submodules to the latest revision on their branch. If I want to go into each submodule and pull the latest code for each (which can be horribly risky, caveat emptor), I can do something like this:
git submodule foreach ‘git checkout master && git pull origin master’
That will go through each of my submodules, ensuring that they are on the latest master branch. That may not be the desired or best behavior, but it is something I learned about with regards to `git submodule update`.
Hi!
I’m very interested in git’s submodules but I can’t find a tutorial that I can understand properly
Could you address this? (or at least point me to your reference tutorial)
Thanks a lot!
Why not create a Git hook for this?
You could use post-checkout & post-merge to automatically fire this on every branch checkout or pull, respectively.