Reset the content of a git repository

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:

  • https://draghici.net/2014/10/01/github-force-pull/
  • https://stackoverflow.com/questions/9529078/how-do-i-use-git-reset-hard-head-to-revert-to-a-previous-commit