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

Re: How to execute a command on git am/rebase/cherry pick --abort ?

From
KKKonstantin Kharlamov <hi-angel@yandex.ru>
Date
Jan 18, 2024, 13:30 UTC
Message-ID
<2c996cb7f83466a4ded11f4f581748c82d24b3c3.camel@yandex.ru>
In-Reply-To
<Zaknu0nwBucHVJPP@tanuki>
On Thu, 2024-01-18 at 14:29 +0100, Patrick Steinhardt wrote:
Show 39 quoted lines
> 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
Oh, this is amazing, thank you! No, I didn't know about it, will use!
Previous: Patrick SteinhardtNext: Konstantin Kharlamov
Message 3 of 5 in “How to execute a command on git am/rebase/cherry pick --abort ?”
  1. Konstantin KharlamovJan 18, 2024
  2. Patrick SteinhardtJan 18, 2024
  3. Konstantin KharlamovJan 18, 2024
  4. Konstantin KharlamovJan 29, 2024
  5. Konstantin KharlamovJan 29, 2024

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.