The long version — what each flag actually does to history, the working tree and the reflog — lives in git undo last commit (keep changes) and git revert vs reset. Stash first, ask later: git stash a single file. The full recovery map: Undo Anything in Git · also on this site: Run LLMs Locally.