Re: Feature request: make reset --hard add something to the reflog

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2025-05-19 at 19:45:21, Josh Bleecher Snyder wrote:
> Hi!
> 
> A feature request:
> 
> I git reset --hard a lot. Every once in a while, it hurts, just
> infrequently enough that I forget the pain and do it again.
> 
> I wish that git reset --hard would silently stash, add to reflog,
> stash drop (or the moral equivalent) and then do the reset. That way I
> could always recover my state post-facto.

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'm not going to commit to implementing it (although I might do so at
some point), but if someone else (or you) wants to do so, I'm sure it
would be quite welcome.

[0] I've been contributing to Git for at least seven years and I still
occasionally lose data (temporarily or permanently) this way.
-- 
brian m. carlson (they/them)
Toronto, Ontario, CA

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux