Skip to content

Git Discard Unstaged Changes

Quincy Larson edited this page Aug 20, 2016 · 1 revision

Discard unstaged changes in Git

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.

To unstage one file :

$ git checkout <path-to-file>

Remember to replace <path-to-file> with the actual file name.

To unstage all files:

$ git checkout -- .

Clone this wiki locally