From: Johannes Sixt Date: Sat, 13 Jun 2026 09:59:11 GMT Subject: Re: [PATCH 0/2] commit: preserve commit hash on a no-op amend Message-ID: <355d4f1a-147c-47e3-ab09-06810d7910c0@kdbg.org> In-Reply-To: Am 13.06.26 um 11:16 schrieb Harald Nordgren via GitGitGadget: > git commit --amend --no-edit rewrote the commit and moved the branch tip > even when nothing changed, because the committer date was reset to "now". > Reuse the existing committer date so a no-op amend keeps the commit hash and > leaves the branch untouched. `git commit --amend --no-edit` is a way to set the committer timestamp to the current time without changing other aspects of the commit. This takes away this ability, doesn't it? Is this keyed to --no-edit? Why is this mode special? Wouldn't it be an identical case when the commit message is passed to the editor, but comes back unchanged? An invocation of `git commit` asks to "please make a new commit". But in the suggested mode, no new commit is created. Shouldn't this then be regarded as failure? What happens with the current branch? Is it left unchanged (no ref update occurs) or is it changed (a ref update occurs, but it happens to be a no-op)? And does this then generate a reflog entry? The updated documentation says about signed commits (note: I am totally clueless about commit signing procedures): > A commit that is being signed (`-S`, or `commit.gpgsign`) > is always rewritten, since its signature cannot reproduce the original. But if the commit doesn't change in any way, why should the signature be invalidated, rewritten, or updated? -- Hannes