git discard local staged changes 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 .