revert all changes in git code example
Example 1: git undo all changes
git reset --hard
Example 2: undo unstaged changes git
git checkout -- .
Example 3: git reset one file
git checkout HEAD -- my-file.txt
git reset --hard
git checkout -- .
git checkout HEAD -- my-file.txt