git reset hard head file code example
Example 1: git file reset to head
git checkout HEAD -- my-file.txt
Example 2: git reset hard directory
git restore --source=HEAD --staged --worktree -- aDirectory
# or, shorter
git restore -s@ -SW -- aDirectory