discard changes to a file in git code example
Example 1: git reset one file
git checkout HEAD -- my-file.txt
Example 2: revert unstaged changes git
git checkout -- path/to/file/to/revert
git checkout HEAD -- my-file.txt
git checkout -- path/to/file/to/revert