git undo changes to file before commit code example
Example 1: git reset one file
git checkout HEAD -- my-file.txt
Example 2: git delete changes
git clean -df
git checkout -- .
git checkout HEAD -- my-file.txt
git clean -df
git checkout -- .