- This will 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):You can also revert uncommitted changes only to particular file or directory:Yet another way to revert all uncommitted changes (longer to type, but works from any subdirectory):
- git reset --hard HEAD
- git checkout [some_dir|file.txt]
- git checkout .
- This will remove all local untracked files, so only git tracked files remain:WARNING: -x will also remove all ignored files, including ones specified by .gitignore! You may want to use -n for preview of files to be deleted.
- git clean -fdx
To sum it up: executing commands below is basically equivalent to fresh git clone from original source (but it does not re-download anything, so is much faster):
git reset
git checkout .
git clean -fdx
Typical usage for this would be in build scripts, when you must make sure that your tree is absolutely clean - does not have any modifications or locally created object files or build artefacts, and you want to make it work very fast and to not re-clone whole repository every single time.
https://stackoverflow.com/questions/14075581/git-undo-all-uncommitted-or-unsaved-changes
이전 커밋 상태로 돌아가는게 아니라 그냥 관리하지않는 내역을 전부 삭제해버리는거였다.
결국 그냥 폴더 지우고 깃에서 다시 다운로드 받고 새롭게 라이브러리 설치.
반응형
'일반' 카테고리의 다른 글
JDD - 멋들어진 개발방법론 (0) | 2022.07.07 |
---|---|
맥 터미널 사용자 이름 가리기 (0) | 2022.03.16 |
github 터미널 앱에서의 인증오류 (0) | 2021.07.12 |
터미널에서 Visual Studio Code로 폴더열기 (0) | 2021.06.28 |
brew cask, Unknown command: cask (0) | 2021.06.24 |