How to revert changes in your working directory or unstage files.
Mistakes happen, and Git provides several ways to undo changes. The method you use depends on what you want to undo. If you have modified a file in your working directory but haven't staged it yet, you can discard those changes and revert the file to the version from your last commit using `git checkout -- <filename>`. This is a destructive operation, so use it with care, as your changes will be lost permanently. If you have already staged a file with `git add` but decide you don't want to include it in the next commit, you can unstage it using `git reset HEAD <filename>`. This command moves the file from the staging area back to the working directory; the modifications themselves are not lost, they are just no longer staged. Understanding these basic undo commands is crucial for managing your work effectively and keeping your commit history clean and intentional. They give you the confidence to experiment, knowing you can easily revert back if things go wrong.