git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: Josh Bleecher Snyder <josharian@gmail.com>,
	 Git Mailing List <git@vger.kernel.org>
Subject: Re: Feature request: make reset --hard add something to the reflog
Date: Mon, 19 May 2025 14:28:07 -0700	[thread overview]
Message-ID: <xmqqjz6cmgt4.fsf@gitster.g> (raw)
In-Reply-To: <aCuMshOaqcuwMCpG@tapette.crustytoothpaste.net> (brian m. carlson's message of "Mon, 19 May 2025 19:55:30 +0000")

"brian m. carlson" <sandals@crustytoothpaste.net> writes:

> I don't know if we want this by default (although I could be convinced
> that we do), but I think this would actually be a great feature to add
> via a config option.  You are not the only person who has accidentally
> destroyed data with `git reset --hard` by any stretch of the
> imagination[0] and this would make that much less painful.

I do not offhand have a strong objection for the _feature_, but if
the implementation uses the default "stash", that is a bit
worrysome, as anybody, even a script, using "reset --hard" would add
a new stash entry, shifting the end-user's expectation of what the
Nth stash entry records behind user's back.

Doesn't "reset --hard" add record to the reflog already, by the way?
I agree that a way to recover the local modifications that "reset
--hard" is designed to get rid of is a good addition.  I just do not
know what the best vehicle to store the local modifications is.


  reply	other threads:[~2025-05-19 21:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-19 19:45 Feature request: make reset --hard add something to the reflog Josh Bleecher Snyder
2025-05-19 19:55 ` brian m. carlson
2025-05-19 21:28   ` Junio C Hamano [this message]
2025-05-19 21:35     ` brian m. carlson

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=xmqqjz6cmgt4.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=josharian@gmail.com \
    --cc=sandals@crustytoothpaste.net \
    /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).