how to undo changes to a file in git code example
Example 1: git reset one file
git checkout HEAD -- my-file.txt
Example 2: git discard staged changes
git reset HEAD
git checkout .
git checkout HEAD -- my-file.txt
git reset HEAD
git checkout .