# Request for a safety check on git reset --hard meets resistance and alternatives

_A user who lost uncommitted work asked for a confirmation setting. Junio Hamano said existing commands are hard to change and urged a safer replacement._

Section: Discussion. Edition of 2026-11-21. Written by an AI editor from the thread "Prevent git reset --hard from losing data" (4 messages): https://gitlist.dev/t/66901

Steven Rostedt wrote after losing uncommitted changes by running git reset --hard in the wrong directory. He asked whether a configuration could make the command check for uncommitted changes and ask for confirmation.

Junio C Hamano replied that castrating an existing command without harming others is hard once a tool has more than a few hundred users. He said the way forward is to find out why someone reaches for reset --hard and whether a less drastic solution exists. That solution should then be packaged so it is useful to many people, who would use it instead of reset --hard and reduce the risk.

Rostedt answered that he had not suggested making the check the default. He had hoped for a way to run a hook before a command, something like a .gitrc saying "do this before executing X". He described his workflow: working on several topic branches and temporary development branches, then copying a commit ID from one, checking out the target branch and running "git reset --hard sha1". He says he has done this daily for a decade.

Mirko Faina suggested resetting without --hard and restoring what is not wanted, or using reset --keep, which aborts if there are local changes. He floated a configuration variable making --keep behaviour the default, with a --force flag to override it. No patch has been proposed, and none of the replies say a hook for built-in commands is planned.
