git/list[1] front-page[2] threads[3] people[4] search[5] about
 

how to update a submodule?

From
OKOliver Kullmann <o.kullmann@swansea.ac.uk>
Date
Dec 31, 2010, 22:24 UTC
Message-ID
<20101231222438.GA28199@cs-wsok.swansea.ac.uk>
Hello,

it would be very helpful if somebody could tell me the supposed workflow how to update a submodule (I'm using version 1.7.3.2; the man-page doesn't say much about it).

I have on the same machine two versions of repository A, say A1, A2, and both contain repository B as submodule, but are otherwise unrelated.

In A1 we have B up-to-date, but not in A2 (and with up-to-date I mean the master branch in the same state as in A1).

git submodule update

is of no help, since A1, A2 have no relation to each other, and "update" assumes some relation; the man-page doesn't speak of options for update, and since "git submodule update" runs through all submodules, it's hard to see how that could work.

So I have to go into B in A2, and do some pull (I suppose), but that doesn't work so easily; the man-page seems to speak of B in A2 is a "normal repository" but that doesn't seem to be the case in the sense that by default we are on "no branch". So it seems one can't do anything there, since you can't merge "no branch" into some other branch. The branch "no branch" is up-to-date after a pull, but this can't be communicated to the other branches (so seems to be misleading, or a waste of time).

So apparently I have to checkout master in A2:B, and then pull from master in A1:B ?

Would be good if somebody could shed light on this.

In general I find that "pull" is much under-documented in git. What I would like to do in A2 is just to say "pull everything from A1", which seems a logical thing to do, and which should include all corresponding branches and all corresponding submodules, but such a "pull all" doesn't seem to exist?

Thanks for your help in any case!
Oliver

P.S. What would be really needed for the Git documentation is to speak about the fundamental ideas, about the "mental images".

The submodule documentation starts with a blurb-sentence which I would regard as misleading. Then comes a paragraph about what it is not. Then comes some hints regarding the implementation. Then the final paragraph seems to indicate that above I could just use "git pull A2" for A1, and would get B in A2 from B in A1, but only not checked out? This doesn't seem to be the case, since apparently then "git submodule update" tries to fetch from some foreign repository (not just checking out what was fetched before)?

Adding here examples for a complete workflow (perhaps with various stages, but without complications(!)), from initialisation to updates from other repositories would be very helpful.

As you can see, I don't know what to expect, and so I don't know what are errors in the usage, and what is supposed to be. No mental image about "submodule" is offered, and I don't know what is its intention. A great thing would be using the computer-science concept of an abstract data type, so to explain what the interface and its semantics is, not what is the implementation.

Next: Seth Robertson
Message 1 of 7 in “how to update a submodule?”
  1. Oliver KullmannDec 31, 2010
  2. Seth RobertsonDec 31, 2010
  3. Oliver KullmannJan 1, 2011
  4. Jens LehmannJan 2, 2011
  5. Oliver KullmannJan 2, 2011
  6. Jens LehmannJan 2, 2011
  7. Jonathan NiederJan 2, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.