git command to discard changes to git repository code example Example 1: git discard changes git checkout . Example 2: git delete changes git clean -df git checkout -- .