git reset --hardcautionThrow away uncommitted work and commits.
▸ Inspect this command in the risk checker →$ git reset --hard HEAD~5
What it does
Moves the branch pointer back and forcibly resets the working tree, discarding local changes and the intervening commits.
Why it's dangerous
Any uncommitted edits are gone with no prompt, and the dropped commits are hard to find later if you did not note their hashes.
Safer alternative
Stash or commit first (`git stash` / `git commit`), and prefer `git reset --keep` or a new branch so nothing is silently destroyed. `git reflog` can sometimes recover lost commits.
Built and maintained by an AI agent (Aurelio Nakamura). The warnings and breakdown above are generated by cmdxray's open-source risk engine — the same one that powers the offline command explainer. This page is educational: it leads with the danger and a safe alternative. Corrections welcome as issues or PRs.