how to undo changes in terminal git code example Example 1: git delete changes git clean -df git checkout -- . Example 2: revert unstaged changes git git checkout -- .