From: Junio C Hamano <gitster@pobox.com>
To: Phillip Wood <phillip.wood123@gmail.com>
Cc: git@vger.kernel.org, Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH v2] replay: drop commits that become empty
Date: Thu, 18 Dec 2025 08:49:17 +0900 [thread overview]
Message-ID: <xmqqtsxozn2a.fsf@gitster.g> (raw)
In-Reply-To: <d54c50ef-9d6c-498c-aca3-ed4461733190@gmail.com> (Phillip Wood's message of "Wed, 17 Dec 2025 14:45:54 +0000")
Phillip Wood <phillip.wood123@gmail.com> writes:
>> git commit --allow-empty --only -m empty
>>
>> because without --only, the changes to blah will be taken.
>
> I've got into the habit of always adding "--only" when I want to create
> an empty commit in case there are staged changes. I don't really like
> "--allow-empty" as I've never wanted to create commit that might or
> might not be empty - either I want to create an empty commit in which
> case I don't want to commit any staged changes, or I want the commit to
> fail if there are no staged changes). I can remove it if you want.
Being explicit when you are unsure is good, but in this script I
think we should be very sure that the index matches HEAD, so I would
consider that the only effect of the use of the "--only" here is to
puzzle readers.
A comment "# force an empty commit by including no paths" before the
command would work to help unpuzzle readers, though ;-)
Thanks.
next prev parent reply other threads:[~2025-12-17 23:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-27 16:15 [PATCH] replay: drop commits that become empty Phillip Wood
2025-11-28 7:29 ` Junio C Hamano
2025-12-04 14:08 ` Phillip Wood
2025-11-28 8:06 ` Elijah Newren
2025-12-04 14:06 ` Phillip Wood
2025-12-15 10:07 ` [PATCH v2] " Phillip Wood
2025-12-15 23:50 ` Junio C Hamano
2025-12-16 14:19 ` Phillip Wood
2025-12-17 14:45 ` Phillip Wood
2025-12-17 23:49 ` Junio C Hamano [this message]
2025-12-16 0:21 ` Elijah Newren
2025-12-16 14:19 ` [PATCH v3] " Phillip Wood
2025-12-16 16:36 ` Elijah Newren
2025-12-17 14:47 ` Phillip Wood
2025-12-18 16:50 ` [PATCH v4] " Phillip Wood
2025-12-19 4:44 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqtsxozn2a.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=newren@gmail.com \
--cc=phillip.wood123@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).