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

Re: Changing branches in supermodule does not affect submodule?

From
Peter Krefting <peter@softwolves.pp.se>
Date
Oct 14, 2009, 06:31 UTC
Message-ID
<alpine.DEB.2.00.0910140728420.16100@ds9.cixit.se>
In-Reply-To
<4AD47C65.5080904@web.de>
Jens Lehmann:
Show 5 quoted lines
> just calling "git submodule update" every time you want the submodule to 
> be updated according to the state committed in the superproject will do 
> the trick (but keep in mind that all referenced commits have to be 
> accessible in the local clone of your submodule, so you might have to do a 
> fetch there once in a while).

Is it possible to automate this from a hook or something else? Basically, I would like it to update all the submodules to the state recorded in the commit I move to, if they were in a clean state before I moved. I do not want it to change states if I do something like

   cd submodule
   # do some changes
   git commit
   cd ..
   git checkout -b newbranch

because there I want the commit I made to the submodule to be recorded on the new branch I created. But then it was in a dirty state before I created the branch anyway, so that shouldn't be a problem.

-- 
\\// Peter - http://www.softwolves.pp.se/
Previous: Jens LehmannNext: Jens Lehmann
Message 3 of 6 in “Changing branches in supermodule does not affect submodule?”
  1. Peter KreftingOct 13, 2009
  2. Jens LehmannOct 13, 2009
  3. Peter KreftingOct 14, 2009
  4. Jens LehmannOct 14, 2009
  5. implement sample post-checkout hook to checkout new/unchanged submodulesHeiko Voigt, Oct 14, 2009
  6. Junio C HamanoOct 14, 2009

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.