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

Re: [PATCH v2 1/3] commit: reword the empty-commit rebase errors

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 27, 2026, 16:35 UTC
Message-ID
<xmqq5x0vbjxd.fsf@gitster.g>
In-Reply-To
<65c48ed3cb638cf0be18a3aa6d86d4c4f2cf01a2.1787792534.git.gitgitgadget@gmail.com>
"Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 31 quoted lines
> From: Elijah Newren <newren@gmail.com>
>
> When a rebase applies a commit that becomes empty, it stops and asks the
> user to decide whether to keep it or drop it.  HEAD still points at the
> previously-applied commit at that point, so either amending or creating
> a partial commit is refused, with one of the following messages:
>
>     You are in the middle of a rebase -- cannot amend.
>     cannot do a partial commit during a rebase.
>
> Neither message hints that the real problem is a commit that became
> empty, and "during a rebase" is overly broad besides -- amending and
> partial commits are fine at an `edit` or `break` stop.  Reword both to
> describe the actual situation.
>
> Signed-off-by: Elijah Newren <newren@gmail.com>
> ---
>  builtin/commit.c              | 4 ++--
>  t/t3404-rebase-interactive.sh | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/builtin/commit.c b/builtin/commit.c
> index 28f6174503..0d908d72bb 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -521,7 +521,7 @@ static const char *prepare_index(const char **argv, const char *prefix,
>  		else if (is_from_cherry_pick(whence))
>  			die(_("cannot do a partial commit during a cherry-pick."));
>  		else if (is_from_rebase(whence))
> -			die(_("cannot do a partial commit during a rebase."));
> +			die(_("cannot do a partial commit while resolving a commit that became empty."));
That is a mouthful.  It also is awkward to say "while resolving a commit".

More importantly, I am not sure if whence == FROM_REBASE_PICK at this point in the code flow is a sufficient sign to tell that we were not just in the middle of a rebase, not just a rebase stopped with _some_ conflict, but the way the rebase stopped was because a step in rebase resulted in a commit that is no-op relative to the previous commit. What makes us certain that the rebase-pick is empty?

Show 7 quoted lines
> @@ -1334,7 +1334,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
>  		else if (is_from_cherry_pick(whence))
>  			die(_("You are in the middle of a cherry-pick -- cannot amend."));
>  		else if (whence == FROM_REBASE_PICK)
> -			die(_("You are in the middle of a rebase -- cannot amend."));
> +			die(_("You are resolving a commit that became empty -- cannot amend."));
>  	}

Again "resolving a commit" sounds a bit awkward. What makes us certain that we aren't seeing an ordinary conflicted "pick" step but the one that has become empty? If "rebase -i" stopped for conflict while applying one step, you edited away conflicts in the working tree files, and instead of saying "rebase --continue" tried to run "commit --amend" by mistake, we do want to stop, but wouldn't it surprise us if the message to stop us said something about "became empty"?

Previous: Elijah NewrenNext: Junio C Hamano
Message 13 of 43 in “commit: refuse to amend during conflict resolution”
  1. commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Aug 26, 2026
  2. Phillip WoodAug 26, 2026
  3. Elijah NewrenAug 27, 2026
  4. Junio C HamanoAug 26, 2026
  5. Elijah NewrenAug 27, 2026
  6. Junio C HamanoAug 26, 2026
  7. Elijah NewrenAug 27, 2026
  8. 0/3 commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Aug 27, 2026
  9. 1/3 commit: reword the empty-commit rebase errorsElijah Newren via GitGitGadget, Aug 27, 2026
  10. Phillip WoodAug 27, 2026
  11. Junio C HamanoAug 27, 2026
  12. Elijah NewrenAug 28, 2026
  13. Junio C HamanoAug 27, 2026
  14. Junio C HamanoAug 27, 2026
  15. Elijah NewrenAug 28, 2026
  16. 2/3 commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Aug 27, 2026
  17. Phillip WoodAug 27, 2026
  18. 3/3 commit: refuse partial commits during conflict resolutionElijah Newren via GitGitGadget, Aug 27, 2026
  19. Phillip WoodAug 27, 2026
  20. Phillip WoodAug 27, 2026
  21. Elijah NewrenAug 27, 2026
  22. 0/5 commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Aug 28, 2026
  23. 1/5 commit: clarify FROM_REBASE_PICK and is_from_rebase() namesElijah Newren via GitGitGadget, Aug 28, 2026
  24. Junio C HamanoAug 28, 2026
  25. Elijah NewrenAug 28, 2026
  26. 2/5 commit: allow a partial commit when a rebase pick becomes emptyElijah Newren via GitGitGadget, Aug 28, 2026
  27. Junio C HamanoAug 28, 2026
  28. 3/5 commit: reword the empty-commit rebase amend errorElijah Newren via GitGitGadget, Aug 28, 2026
  29. Junio C HamanoAug 28, 2026
  30. 4/5 commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Aug 28, 2026
  31. 5/5 commit: refuse partial commits during conflict resolutionElijah Newren via GitGitGadget, Aug 28, 2026
  32. Junio C HamanoAug 28, 2026
  33. 0/5 commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Sep 1, 2026
  34. 1/5 commit: clarify FROM_REBASE_PICK and is_from_rebase() namesElijah Newren via GitGitGadget, Sep 1, 2026
  35. Phillip WoodSep 2, 2026
  36. 2/5 commit: allow a partial commit when a rebase pick becomes emptyElijah Newren via GitGitGadget, Sep 1, 2026
  37. Phillip WoodSep 2, 2026
  38. 3/5 commit: reword the empty-commit rebase amend errorElijah Newren via GitGitGadget, Sep 1, 2026
  39. Phillip WoodSep 2, 2026
  40. 4/5 commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Sep 1, 2026
  41. Phillip WoodSep 2, 2026
  42. 5/5 commit: refuse partial commits during conflict resolutionElijah Newren via GitGitGadget, Sep 1, 2026
  43. Phillip WoodSep 2, 2026

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.