Removing commit history from git/github

Resetting commit history by replacing main branch

From your terminal run:

# Checkout from your main branch
git checkout --orphan latest_branch

# Add all the files
git add -A

# Commit your changes
git commit -am "commit message"

# Delete the original 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

And you are done.