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

Re: [PATCH] rebase -i: use same commit's message and date with f -C

From
KHKristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Date
Sep 23, 2025, 17:37 UTC
Message-ID
<4e74c0c0-11a8-42bc-a229-196402628b7e@app.fastmail.com>
In-Reply-To
<92d4d585-09e9-4f1d-a471-1ad6b312fa61@app.fastmail.com>
On Tue, Sep 23, 2025, at 10:55, Mathias Rav wrote:
> In `git rebase -i` with the fixup command, the -C flag controls whether
> the commit message is taken from the previous or current commit,

That’s also for `fixup -c`. With `fixup -C` it just also does not open the editor.

Maybe this refers to how `amend!` is changed to `fixup -C`?
Show 7 quoted lines
> but currently the author name, email and date are always taken from the
> previous commit. The fixup command is used to squash two commits where
> one commit has a good message and the other's message does not matter,
> and it is usually also the case that the commit with the good message
> is the one that has the good authorship information; the other is a
> fixup commit that was presumably made by the user moments ago, whereas
> the commit with the good message is the one whose date should be kept.
I think the rule from the manual
       If you want to fold two or more commits into one, replace the
       command "pick" for the second and subsequent commits with
       "squash" or "fixup". If the commits had different authors, the
       folded commit will be attributed to the author of the first
       commit. ...

is simple enough. Adding this exception for `fixup -C` doesn’t make sense to me.

Why not use `git commit --amend --reset-author --no-edit` in that case?[1]

Granted using `fixup -C` is more advanced interactive use than what I get into.

† 1: On author date: I had a commit from the first of June that I got
    back to.  After rewriting the commit message and adding more things
    to it the author date still says first of June.  For better or worse
    this is apparently the “normal” baseline.
Show 22 quoted lines
> Most of the time, a fixup commit is made on top of the commit to be
> fixed up, in which case the rebase -i fixup command is used without -C.
> The fixup -C case arises when an earlier commit in the branch is split,
> leaving part of the commit to be squashed into a later commit, in which
> case fixup -C would be expected to keep the date on the later commit,
> and discard the author date of the ephemeral newly split commit.
>
> Change the behavior so that fixup with -C takes both message and author
> from the current commit, instead of taking the author from the previous.
>
> Tweak try_to_commit to allow specifying author in addition to AMEND_MSG,
> and pass author from the current commit in do_pick_commit in `f -C`.
>
> Tweak the help text in `git rebase -i` to reflect the changed behavior.
>
> Add a test that ensures that the author metadata for the second current
> commit is kept, and remove some author metadata checks from other tests
> that now fail since the author metadata is different (as intended).
>
> Signed-off-by: Mathias Rav <m@git.strova.dk>
> ---
>[snip]
-- 
Kristoffer
Previous: Ben KnobleNext: Junio C Hamano
Message 5 of 14 in “rebase -i: use same commit's message and date with f -C”
  1. rebase -i: use same commit's message and date with f -CMathias Rav, Sep 23, 2025
  2. Karthik NayakSep 23, 2025
  3. Phillip WoodSep 23, 2025
  4. Ben KnobleSep 23, 2025
  5. Kristoffer HaugsbakkSep 23, 2025
  6. Junio C HamanoSep 23, 2025
  7. Johannes SixtSep 24, 2025
  8. Phillip WoodSep 24, 2025
  9. Mathias RavSep 24, 2025
  10. Phillip WoodSep 25, 2025
  11. Junio C HamanoSep 25, 2025
  12. Oswald BuddenhagenSep 24, 2025
  13. Junio C HamanoSep 24, 2025
  14. Phillip WoodSep 25, 2025

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.