重置所有改动
git reset
git checkout .
git clean -fdx
- Unstage all files you might have staged with
git add
git reset
- This will revert all local uncommitted changes (should be executed in repo root):
git checkout .
- Revert uncommitted changes only to particular file or directory:
git checkout file.path
- Another way to revert all uncommitted changes (longer to type, but works from any subdirectory):
git reset --hard HEAD
- Remove all local untracked files, so only git tracked files remain:
git clean -fdx
WARNING: -x will also remove all ignored files