threads / discuss / 56100

Confusing interaction between 'rebase -i' and 'commit.verbose' when squashing commits

Subject: Confusing interaction between 'rebase -i' and 'commit.verbose' when squashing commits

## tl;dr

2 messages between Jul 13, 2021 and Jul 13, 2021.

replies: 1people: 1as markdown or json

Philippe Blain· Jul 13, 2021, 19:34 UTC · lore
Hi,

I encountered a situation when I did an interactive rebase and changed two 'picks' to 'squash', without re-ordering anything. I have 'commit.verbose' set in my config.

When I then saved the todo list to start the rebase, it opened my editor to edit the message for the squashed commit. The message shown in the editor is as expected (the messages from the three commits are shown), but the diff below the scissors line, due to commit.verbose, corresponds to the squashed changes only from the *first two commits* (the 'pick' and the first 'squash'); the changes from the second 'squash' are missing.

Running 'git diff --cached' in a second shell shows that those changes (the ones from the second 'squash') are correctly staged. HEAD points to a commit that has the changes from the 'pick' and the first 'squash', and as commit message the message I'm seeing in my editor.

This is rather confusing.

I do not have a quick reproducer unfortunately and I'm in a bit of a rush, but I thought I'd just send this in case anyone notices quickly why this happens just by reading the code (I would think somewhere in 'sequencer.c').

Cheers,
Philippe.
Philippe Blain· Jul 13, 2021, 19:42 UTC · re: Philippe Blain · lore

Re: Confusing interaction between 'rebase -i' and 'commit.verbose' when squashing commits

Le 2021-07-13 à 15:34, Philippe Blain a écrit :
Show 6 quoted lines
> 
> Running 'git diff --cached'
> in a second shell shows that those changes (the ones from the second 'squash')
> are correctly staged. HEAD points to a commit that has the changes from
> the 'pick' and the first 'squash', and as commit message the message I'm
> seeing in my editor.
Correction: the message in my editor has the messages from all three commits,
but the message of the commit pointed by HEAD only has the messages from the
first two commits, i.e. the 'pick' and the first 'squash'
This is on with Git 2.32.0.1.g2ac0338718.

← back to recent threads