on to undo changes on one file 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