git restore <file>Discard changes in working directory (unstage + revert)
git restore --staged <file>Unstage a file (keep changes in working directory)
git restore --source=HEAD~1 <file>Restore file to state from one commit ago
git reset --soft HEAD~1Undo last commit, keep changes staged
git reset --mixed HEAD~1Undo last commit, keep changes unstaged (default)
git reset --hard HEAD~1Undo last commit and discard all changes (⚠️ destructive)
git reset --hard <commit-hash>Reset to a specific commit (discards everything after)
git revert <commit-hash>Create a new commit that undoes a specific commit (safe)
git stashTemporarily save uncommitted changes (clean working directory)
git stash listList all stashes
git stash popApply the latest stash and remove it from stash list
git stash applyApply the latest stash without removing it
git stash dropRemove the latest stash