git restore

Restore working tree files. Requires Git version 2.23+. See also git checkout and git reset. More information: https://git-scm.com/docs/git-restore.

git restore {{path/to/file}}

git restore {{[-s|--source]}} {{commit}} {{path/to/file}}

git restore :/

git restore {{[-S|--staged]}} {{path/to/file}}

git restore {{[-S|--staged]}} :/

git restore {{[-W|--worktree]}} {{[-S|--staged]}} :/

git restore {{[-p|--patch]}}