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

Re: git-status for submodules

From
Johan Herland <johan@herland.net>
Date
Nov 21, 2008, 15:27 UTC
Message-ID
<200811211627.10637.johan@herland.net>
In-Reply-To
<7vabbtqga8.fsf@gitster.siamese.dyndns.org>
On Friday 21 November 2008, Junio C Hamano wrote:
Show 29 quoted lines
> Chris Frey <cdfrey@foursquare.net> writes:
> > I'm using git 1.6.0.4 and trying to make submodules work for me. 
> > The init/add/update steps are a bit tedious, but workable.  The
> > problem I have is when I make a change in a submodule, then
> > git-status does not show the change.
>
> My understanding is that this is exactly by design.  The supermodule
> tracks which commit in the subproject is bound to the tree location.
>
> A mere act of changing something in the subproject directory is just
> a single, incomplete step to create a new commit in the subproject
> and will
>
> not be seen by the superproject's status.  Instead of this workflow:
> > 	cd super
> > 	vi newsuper
> > 	vi existing_file
> > 	cd sub
> > 	vi newsub
> > 	cd ..
> > 	git status
>
> the submodule support is geared toward supporting this layout:
>
> 	- "super" has a subproject X at "sub"
>
>         - When you do a real work on the subproject X, you do so as
> if there is no supermodule.  IOW, subproject X has to be able to
> stand on its own.

Chris' workflow is farily easily supported by running git-status within each submodule, like this:

git submodule foreach "git status; true"

If the above is too cumbersome to type, one can easily wrap an alias around it:

git config alias.substatus 'submodule foreach "git status; true"' git substatus

Have fun! :)
...Johan
-- 
Johan Herland, <johan@herland.net>
www.herland.net
Previous: Junio C HamanoNext: Chris Frey
Message 3 of 6 in “git-status for submodules”
  1. Chris FreyNov 20, 2008
  2. Junio C HamanoNov 21, 2008
  3. Johan HerlandNov 21, 2008
  4. Chris FreyNov 21, 2008
  5. Chris FreyNov 21, 2008
  6. Junio C HamanoNov 22, 2008

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.