How to discard local changes or unstage a file (git restore)
Run git restore --staged <file> to unstage a file but keep your edits. Run git restore <file> to throw away your uncommitted changes and go back to the last committed version.
Step by step
Unstage, keep the edits:
$ git restore --staged README.mdDiscard the edits (can't be undone):
$ git restore README.mdDiscard every change in the project:
$ git restore .
Older guides use git checkout -- <file> and git reset HEAD <file>: they do the same thing.