Restore working tree files. Requires git version 2.23+ Also see git checkout.

# To restore a deleted file from the contents of the current commit (HEAD):
git restore <path/to/file>

# To restore a file to a version from a different commit:
git restore --source <commit> <path/to/file>

# To undo any uncommitted changes to tracked files, reverting to the current HEAD:
git restore .