Empty GitHub repository instead of deleting and re creating

Time:2021-7-21

Today, because I wanted to empty the GitHub warehouse and come back, I didn’t know how to solve it later, so I searched for information online and posted a blog by the way

— Remove the history from

(delete history from)

rm -rf .git

— recreate the repos from the current content only

(recreate repository from current content only)

git init
git add .
git commit -m “Initial commit”

— push to the github remote repos ensuring you overwrite history

(push to your remote warehouse to make sure your history is covered)

git remote add origin [email protected]:<YOUR ACCOUNT>/<YOUR REPOS>.git
git push -u –force origin master

Source: https://gist.github.com/stephenhardy/5470814