* Prevent git reset --hard from losing data
@ 2026-11-20 19:54 Steven Rostedt
2026-11-20 21:09 ` Mirko Faina
0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2026-11-20 19:54 UTC (permalink / raw)
To: git
Hi,
Too many times I do a "git reset --hard" in the wrong directory and end up
losing uncommitted changes. Is there a way to add a configuration to have
that command check if there's any uncommitted changes and ask if you really
want to do the reset?
[ I'm writing this after I just lost some uncommitted changes from doing this :-( ]
Thanks,
-- Steve
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Prevent git reset --hard from losing data
2026-11-20 19:54 Prevent git reset --hard from losing data Steven Rostedt
@ 2026-11-20 21:09 ` Mirko Faina
0 siblings, 0 replies; 2+ messages in thread
From: Mirko Faina @ 2026-11-20 21:09 UTC (permalink / raw)
To: Steven Rostedt; +Cc: git, Mirko Faina
On Fri, Nov 20, 2026 at 02:54:44PM -0500, Steven Rostedt wrote:
> Too many times I do a "git reset --hard" in the wrong directory and end up
> losing uncommitted changes. Is there a way to add a configuration to have
> that command check if there's any uncommitted changes and ask if you really
> want to do the reset?
You could just reset without the --hard option and restore what you
don't want to keep. Otherwise there's the --keep option that aborts the
reset if there's local changes, but you'd have to remember to type it
out every time.
Maybe a configuration variable that makes the --keep behaviour the
default could be added with a --force flag to override it.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-20 21:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 19:54 Prevent git reset --hard from losing data Steven Rostedt
2026-11-20 21:09 ` Mirko Faina
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.