how to revert local change git code example Example 1: git undo all changes git reset --hard Example 2: undo unstaged changes git git checkout -- .