create empty branch in github code example

Example: create empty branch in github

$ git checkout --orphan NEWBRANCH
$ git rm -rf .

--orphan creates a new branch, but it starts without any commit. 
After running the above command you are on a new branch "NEWBRANCH",
and the first commit you create from this state will start a new 
history without any ancestry.

You can then start adding files and commit them and they will
live in their own branch. If you take a look at the log, 
you will see that it is isolated from the original log.

ANOTHER WAY:

You could first delete branch master.
git branch -D master.

Then create a new branch named "master" off of the NEWBRANCH.
git checkout NEWBRANCH
git checkout -b master

ANOTHER WAY:

You could also reset master to NEWBRANCH by doing:
git checkout master
git reset --hard NEWBRANCH

which removes the need of first deleting it

Tags:

Misc Example