Command

git restore

Restore selected paths. Default working-tree source is the index; with --staged the default source is HEAD. Can discard content. Inspect and preserve edits first.

Formal Syntax & Structure

git syntaxgit
git restore [--source=REV] [--staged] [--worktree] -- PATH

Working Example

Example Snippetgit
git restore -- notes.txt
Git Reference