git-restore
Restore working tree files. tldr-pages
On several platforms
Several platforms
Restore working tree files. Requires Git version 2.23+.
Restore an unstaged file to the staged version
git restore path/to/fileIdentifyRestore an unstaged file to the version of a specific commit
git restore --source commit path/to/fileIdentifyDiscard all unstaged changes to tracked files
git restore :/IdentifyUnstage a file
git restore --staged path/to/fileIdentifyUnstage all files
git restore --staged :/IdentifyDiscard all changes to files, both staged and unstaged
git restore --worktree --staged :/IdentifyInteractively select sections of files to restore
git restore --patchIdentify