git restore file: discard uncommitted changes in a file.git restore --staged file: unstage a file (keep the changes).git commit --amend: change the last commit (message or content). Only before pushing!git revert <commit>: create a new commit that undoes an old one. Safe for shared history.git reset --soft HEAD~1: undo the last commit but keep its changes staged.
git reset --hard permanently deletes uncommitted work. Use it with great care.