Clear all the contents of a Git repo

The following steps are suggested here:…-repository

  • Here’s the brute-force approach. It also removes the configuration of the repo.
  1. remove all history
rm -rf .git
  1. reconstruct the Git repo with only the current content
git init
git add .
git commit -m "Initial commit"
  1. push to GitHub.
git remote add origin <github-uri>
git push -u --force origin master