Git – create empty branch

Git represents branches as pointers to the latest commit in that branch. If you haven’t created a commit yet, there’s nothing for that branch to point to. So you can’t really create branches until you have at least one commit.

Git allows to create a empty branch but its not common way of using Git.

First create create an empty Git repository by using following command:

$ git init

To create empty branch use following command:

$ git commit --allow-empty -m "initial commit for empty brach"

After running above command it will create a master branch, run following command to conform:

$ git branch


* master

By Sandeep Posted in Git Tagged