git undo local changes to a file code example Example 1: git undo all changes git reset --hard Example 2: how to remove file changes in git git clean -df git checkout -- .