git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Lehmann <Jens.Lehmann@web.de>
To: Peter Krefting <peter@softwolves.pp.se>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Changing branches in supermodule does not affect submodule?
Date: Wed, 14 Oct 2009 17:39:29 +0200	[thread overview]
Message-ID: <4AD5F0B1.4000507@web.de> (raw)
In-Reply-To: <alpine.DEB.2.00.0910140728420.16100@ds9.cixit.se>

Peter Krefting schrieb:
> Jens Lehmann:
> 
>> 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).

BTW: unless you use the -N or --no-fetch option, git submodule update
will do the fetch for you.


> Is it possible to automate this from a hook or something else?

Yep, you can use the post-checkout hook for that, just put a "git
submodule update" in it.

*But*: If you do a checkout in the superproject while the submodule
has new commits not contained in any branch (remember submodules
often have a detached head) you'll silently lose these commits!
Then only the reflog can help you ...

  reply	other threads:[~2009-10-14 15:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-13 10:29 Changing branches in supermodule does not affect submodule? Peter Krefting
2009-10-13 13:11 ` Jens Lehmann
2009-10-14  6:31   ` Peter Krefting
2009-10-14 15:39     ` Jens Lehmann [this message]
2009-10-14 20:12       ` [RFC PATCH] implement sample post-checkout hook to checkout new/unchanged submodules Heiko Voigt
2009-10-14 20:02     ` Changing branches in supermodule does not affect submodule? Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AD5F0B1.4000507@web.de \
    --to=jens.lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=peter@softwolves.pp.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).