I found this as I was looking for a solution to nuke my project directory, great job!
However I found that it only supports .gitignore on root (did not delete all node_modules in a monorepo setup) so I had to find a solution.
That's when I realized that rimraf * && git reset --hard could do a similar job and solve it for me.