git reset <commit> moves your branch pointer back to an earlier commit. The flag decides what happens to your files and staging area.
--soft HEAD~1 — uncommit the last commit, but keep its changes staged. Use when the commit's content was right but the message or grouping was wrong; just commit again.
--mixed HEAD~1 (default) — uncommit and unstage. Changes still on disk, ready to re-stage selectively.
--hard HEAD~1 — uncommit, unstage, and discard the changes on disk. Nuclear. The work is only recoverable via reflog.
A common safety move: git reset --hard origin/main makes your branch exactly match the remote — useful when local state is beyond saving.