How can I completely empty the master branch in Git?

git, git-branch

Solution

That's actually called "delete old master branch and create new from scratch"

This will create a new master branch pointing to initial commit:

git branch -D master
git checkout -b master <initial commit hash>

This will create a totally new master branch unrelated to whatever you had:

git branch -D master
git checkout --orphan master
git rm -rf *

But actually you can simply save current repository to some other place and create a new repository instead.

Problem

I would like to completely empty the master branch in Git. For now, I would also like to keep all other branches which have been branched from master. Is this possible and how?

Original source

Related problems