how to disrcard change sin git code example Example 1: git undo all changes git reset --hard Example 2: git discard staged changes git reset HEAD git checkout .