clear modifed changes git code example Example 1: git reset one file git checkout HEAD -- my-file.txt Example 2: revert unstaged changes git git checkout -- .