Can’t discard changes from git repo

Sometimes in git repository appears changes that cannot be discarded. To discard such changes, enter the following commands into the terminal:

git rm --cached -r .

git reset --hard