NOT git reset -hard !
Please, use
git stash -u
instead of this! If you have a job that you accidentally classified, you can still return it. It never gets on your remote control unless you want to do it by pulling a branch out of it and pushing it.
Also, you are on the right track that you can use git checkout to accomplish the same thing. Syntax git checkout HEAD -- . . But it has the same problem as git reset --hard . Stick to the application, and in the future you will save your hair.
Longer answer
The above solutions bring back all your changes. However, you asked how to get rid of some changes. I will add this for completeness.
To do this, you can
git add file1 file2 file3 git stash save --patch
Now you will be asked what exactly you want to do dissappear ... down to the level of detail. Thus, you can safely βrejectβ only a few changes to a single file if you decide to do so.
source share