Git · History and recovery
git restore
Discards working-tree changes for a path, or restores a staged file with --staged. Be certain before running it.
Syntax
git restore <path>Example
Example
git restore src/app.ts git restore --staged src/app.ts
More in this group
Learn this in the course
Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.