Git development
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Cc: git@vger.kernel.org
Subject: Re: How to execute a command on git am/rebase/cherry pick --abort ?
Date: Thu, 18 Jan 2024 14:29:31 +0100	[thread overview]
Message-ID: <Zaknu0nwBucHVJPP@tanuki> (raw)
In-Reply-To: <d66ef46827fc7391bd74ece943afa2c5245896d6.camel@yandex.ru>

[-- Attachment #1: Type: text/plain, Size: 1338 bytes --]

On Thu, Jan 18, 2024 at 03:53:21PM +0300, Konstantin Kharlamov wrote:
> (please keep me CC'ed, I'm not subscribed)
> 
> Hello!
> 
> There's a well-known problem of git not fully checking out changes
> while doing e.g. `git checkout` and similar commands when you have
> submodules. So e.g. if HEAD changes a submodule commit and you do an
> interactive rebase to HEAD~2, you may be lucky to find a submodule
> commit change in `git diff` (because if you don't get lucky, you won't
> notice that and commit the change to the unrelated HEAD~2).
> 
> As a workaround I have a `git submodule update` inside `post-checkout`
> hook.
> 
> Now, the problem is I still often finding myself having the wrong
> submodule ID, and I tracked down that problem to commands such as
> `am/rebase/cherry-pick --abort` also not updating the submodule, nor
> executing `post-checkout`.
> 
> I looked through `man githooks` but couldn't find any way to execute a
> `git submodule update` during these aborts.
> 
> Any ideas how to fix these?

Are you aware of the `submodule.recurse` config? If set, it should cause
git-checkout(1) and many other commands to recurse into submodules and
update them accordingly. This should both make your post-checkout hook
obsolete and should also work with git-cherry-pick(1) et al.

Patrick

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2024-01-18 13:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18 12:53 How to execute a command on git am/rebase/cherry pick --abort ? Konstantin Kharlamov
2024-01-18 13:29 ` Patrick Steinhardt [this message]
2024-01-18 13:30   ` Konstantin Kharlamov
2024-01-29 14:35   ` Konstantin Kharlamov
2024-01-29 14:40     ` Konstantin Kharlamov

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=Zaknu0nwBucHVJPP@tanuki \
    --to=ps@pks.im \
    --cc=Hi-Angel@yandex.ru \
    --cc=git@vger.kernel.org \
    /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