Search code examples
gitbranch

Git create a empty branch from existing repository


I have a git repository which has many branches my requirement is to create a new empty branch so that its independent of the earlier branches.


Solution

  • That's not a good practice, but if you want really start with a new branch without relation to master you must use --orphan argument of checkout :

    git checkout --orphan version2
    # and remove your project files
    

    You'll get more detail about --orphan arguments in the doc : http://git-scm.com/docs/git-checkout