Subject: Re: [PATCH] reset: avoid reflog update on no-op reset

From: Junio C Hamano <[email-masked]>
Date: Thu, 22 Jan 2026 10:57:02 -0800

Pushkar Singh <[email-masked]> writes:

> When "git reset" is invoked with a target that already matches HEAD,
> it currently writes a reflog entry even though no reference is updated.
>
> Detect this no-op case and avoid updating ORIG_HEAD and HEAD, skipping
> the reflog entry entirely.

I am mildly negative on this one.  A scripted use that gets which
commit to reset to from the caller in the outside world, e.g.,

    #!/bin/sh
    git reset --hard "$1"
    git diff --stat @{1}

would be confused if reflog does not reliably store the state before
running "reset --hard" to @{1}.  In other words ...

> Add a regression test to ensure no reflog entry is written for a no-op
> reset.

... this change may already be a regression for existing users.