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

Re: [PATCH v4 3/5] commit: reword the empty-commit rebase amend error

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Sep 2, 2026, 15:39 UTC
Message-ID
<050c4aee-8e90-4063-ae70-551ad4f53746@gmail.com>
In-Reply-To
<c4511a98875a402a59e3109fcfe3839c2564753c.1788301481.git.gitgitgadget@gmail.com>
Hi Elijah
On 01/09/2026 23:24, Elijah Newren via GitGitGadget wrote:
Show 13 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 amending is refused, with:
> 
>      You are in the middle of a rebase -- cannot amend.
> 
> That message would suggest that amending is not allowed during an 'edit'
> or 'break' stop, which is misleading, plus it lacks the specificity that
> might help the user know why their particular case is a problem: the
> commit they intended to amend became empty and was dropped, so amending
> would affect the wrong commit.  Reword the error accordingly.
I agree the new message is clearer
Thanks
Phillip
Show 32 quoted lines
> Signed-off-by: Elijah Newren <newren@gmail.com>
> ---
>   builtin/commit.c              | 2 +-
>   t/t3404-rebase-interactive.sh | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/builtin/commit.c b/builtin/commit.c
> index 01b79185e7..9b6eaa3c72 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -1332,7 +1332,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 (is_from_rebase_now_empty(whence))
> -			die(_("You are in the middle of a rebase -- cannot amend."));
> +			die(_("The now-empty commit has been dropped -- cannot amend."));
>   	}
>   	if (fixup_message && squash_message)
>   		die(_("options '%s' and '%s' cannot be used together"), "--squash", "--fixup");
> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
> index 3588e16543..81f4844950 100755
> --- a/t/t3404-rebase-interactive.sh
> +++ b/t/t3404-rebase-interactive.sh
> @@ -1880,7 +1880,7 @@ test_expect_success 'correct error message for commit --amend after empty pick'
>   	) &&
>   	echo x>file1 &&
>   	test_must_fail git commit -a --amend 2>err &&
> -	test_grep "middle of a rebase -- cannot amend." err
> +	test_grep "now-empty commit has been dropped -- cannot amend." err
>   '
>   
>   test_expect_success 'todo has correct onto hash' '
Previous: Elijah Newren via GitGitGadgetNext: Elijah Newren via GitGitGadget
Message 39 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.