git restore <file>
=> Restores the file in the working directory
to match the staging area (index).
If the file is not staged, it restores it from the last commit.
git restore --staged <file>
=> Removes the file from the staging area
(keeps the changes in the working directory).
git restore --source=<commit> <file>
=> Replaces the file in the working directory
with its version from the specified commit.
git show <commit>:<file>
=> Prints the content of the file as it was in that commit.
git checkout <file>
=> Older command that restores the file from the index
(similar to git restore <file>).
git restore is the newer and clearer alternative.
git revert <commit>
=> Creates a new commit that undoes the changes
introduced by the specified commit.
(It does NOT delete history.)