Reset the content of a git repository

Sometimes, in your git repository, you realise everything you did is wrong and you need to start over. Then, this is what you need to do!

Reset the content:

git reset --hard HEAD

Clean the content of the repository:

git clean -f

And one command which will clean everything, including the ignored files or folders (e.g. node_modules):

git clean -xdf

Sources: