• 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

 

git undo all uncommitted or unsaved changes

I'm trying to undo all changes since my last commit. I tried git reset --hard and git reset --hard HEAD after viewing this post. I responds with head is now at 18c3773... but when I look at my local

stackoverflow.com

 

 

 

 

 

이전 커밋 상태로 돌아가는게 아니라 그냥 관리하지않는 내역을 전부 삭제해버리는거였다.

결국 그냥 폴더 지우고 깃에서 다시 다운로드 받고 새롭게 라이브러리 설치.

+ Recent posts