I want to stress how dangerous this command can be. If you were to simply delete a committed file, it would be trivially easy to recover because it is tracked in Git. However, if you used git reset --hard to undo committing that file, it would be deleted for good.
Always be careful when using git reset --hard. It's a powerful tool, but it's also a dangerous one.
If you want to reset back to a specific commit, you can use the git reset --hard command and provide a commit hash. For example:
git reset --hard a1b2c3d
This will reset your working directory and index to the state of that commit, and all the changes made after that commit are lost forever.
Be super careful with this. In part 2 of this course, we'll cover more advanced (read: safer) ways to undo changes.