Git Discard Unstaged Changes - ashish9342/FreeCodeCamp GitHub Wiki
When using Git, it is common to make changes that you want to remove entirely before the staging phase. For example, after working on a few files, you realize that you want to revert the changes made to one specific file. To discard the changes before staging and committing, use the $ git checkout
command.
$ git checkout <path-to-file>
Remember to replace <path-to-file>
with the actual file name.
$ git checkout -- .