discard chagnes to file git code example
Example 1: git reset change in one file
# undo local changes to specific file
git checkout -- file
Example 2: git discard staged changes
git reset HEAD
git checkout .
# undo local changes to specific file
git checkout -- file
git reset HEAD
git checkout .