git restore
git restore [--staged] [--source=<commit>] <file>
Risk: Can lose work
What it does
Puts a file back to a saved version.
When to use it
To throw away a change you don't want.
Example
$ git restore index.htmlThrow away changes. They are gone!
$ git restore --staged index.htmlTake it out of the box. Safe: the change stays.
Learn it in: Throw away a change · Official docs