From: Junio C Hamano Date: Fri, 20 Nov 2026 22:02:16 GMT Subject: Re: Prevent git reset --hard from losing data Message-ID: In-Reply-To: <20261120145444.13061eb7@gandalf.local.home> Steven Rostedt writes: > 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 do not think so. Castrating an existing command without harming others is a hard thing to do once the tool gains more than a few hundred of users, and we probably have more users than that. I think you need to go to the root of the issue. Find out what made you want to run "git reset --hard" and see if there are less drastic solution to the same issue. And come up with a way to package that less drastic solution in a form that would be useful to many people. That way, people would start using that newer solution and less often be running "git reset --hard", reducing the risk. When somebody really needs to do "git reset --hard" or a script that has happily been running "git reset --hard", it will continue to do the destructive thing as it was designed to, and everybody will be happy.