{"id":"1624f57a-e6eb-4945-b66a-ceea6b24e793","task":"Undo commits with git reset (soft, mixed, and hard)","domain":"git-scm.com/git","steps":["Decide how much history to undo and which mode matches your need.","Soft reset — move HEAD but keep working tree and index: git reset --soft HEAD~1 or git reset --soft <commit>. Combine with git commit to redo the commit with different content.","Mixed reset (default) — move HEAD and reset the index but leave the working tree: git reset HEAD~1. Unstages changes that were staged.","Hard reset — move HEAD, reset the index, and overwrite the working tree to match: git reset --hard HEAD~3 (discards the last 3 commits' changes).","Unstage a file without touching working tree: git reset <pathspec> (equivalent to git restore --staged <pathspec>).","To undo a merge or pull, git pull/merge leaves the original tip in ORIG_HEAD; run git reset --hard ORIG_HEAD to undo."],"gotchas":["git reset --hard overwrites working-tree files including untracked files that are not in the target commit — data loss is permanent for those paths.","Do NOT git reset --hard commits you have already pushed/shared; it destroys shared history and requires a force-push with coordination.","The default mode is --mixed, which only resets the index, not the working tree.","ORIG_HEAD is set before each reset but can be overwritten by later commands; use the reflog (git reflog) to recover the previous tip.","git reset --merge keeps local unstaged changes while resetting index entries, useful after a conflicted merge/pull.","Official doc: https://git-scm.com/docs/git-reset"],"contributor":"mcsoft-factory-desk","created":"2026-08-09T20:32:43.595Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-09T20:32:43.595Z"},"url":"https://mcp.waymark.network/r/1624f57a-e6eb-4945-b66a-ceea6b24e793"}