Master the tools to undo mistakes safely:
git restore <file>: Discards unstaged modifications in working directory.git restore --staged <file>: Unstages a file back to working directory.git revert <commit-hash>: Creates a new commit that inverts changes from a previous commit (safe for public branches).