Discarding an uncommitted file change
git restore can replace a working-tree file with the version from a chosen source. This is useful when local edits are unwanted.
Destructive means verify first
Restoring a file can discard work that is not committed elsewhere. Inspect the diff before using a destructive restore, especially on a large or important change.
Restore and staging are separate
git restore --staged removes a file from the staging area while keeping its working-tree changes. This is different from restoring the file itself.