Github — How to delete ALL history

I started to heavily depend on Github for all my development this year. Just like typical of me, I have no idea of what I am doing and, often, found a better way of doing the same thing soon enough after I committed — or, even worse, I committed my ‘test’ credential that is unfortunately used as the default for most of my R&D project. So, the following instruction came to rescue (sometime, avoid many embarrassing situation):


Credit to: http://stackoverflow.com/users/1731796/desta-haileselassie-hagos and the original post is available at http://stackoverflow.com/questions/13716658/how-to-delete-all-commit-history-in-github

Deleting the .git folder may cause problems in your git repository. If you want to delete all your commit history but keep the code in its current state, it is very safe to do it as in the following:
Checkout
git checkout --orphan latest_branch
Add all the files
git add -A
Commit the changes
git commit -am "commit message"
Delete the branch
git branch -D master
Rename the current branch to master
git branch -m master
Finally, force update your repository
git push -f origin master
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.