Understanding git submodules
I had to refer to this today, when I discovered (much to my surprise) that git submodules update
does, for the most part, nothing.
You might expect it to update all my git submodules to the latest revision. Nope, I’m supposed to cd into each of those directories myself and run git pull
myself.
The only hint that git update will do nothing of use is a single sentence in the help page, which mentions as part of the update command’s summary: “This will make the submodules HEAD be detached”. Which is a fairly unintelligible statement, even to someone who’s been using git for about a year now.
I can’t imagine when you would run git submodule update
after the initial checkout - why doesn’t git submodule init
just do update’s job (actually fetching the initial content), and then maybe we could have an update that actually pulls updates? I’d even be satisfied to have to use a flag, like --hard
, --please
or --come-on-old-chap-just-do-it-would-you
I’m pretty new to git’s submodules, and so far they just seem to take far too many manual steps (I don’t understand why they’re not fetched by a clone
, for starters). I feel wrong saying so, but I miss svn:externals.
Tell me, how are things in the land of the other DVCS’s?
Update: Looks like my git is outdated, the newest version (1.6) allows a --merge
or --rebase
flag to update
which sounds like it does what I want. Now I just need to sort out my mac’s package management :s