'How to delete all commits from private repository in github?

I want to add gitignore with 2 files( node_module,another one) in a private repository which is given by github classroom. But I already git pushed for several times on that repository. Now I want to add gitignore, but after adding gitnore. the previous commited files (node_module, another one) are still in that repository. Now how I can remove all previous commits and git init again on that private repo?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source