How to create a branch without adding all the existing files?

后端 未结 3 1641
天命终不由人
天命终不由人 2021-01-31 15:58

When I create branch in git, all the created files are added to the new branch.

How can I create a branch without adding all the existing files?

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-31 16:53

    From the Git Book

    git symbolic-ref HEAD refs/heads/newbranch 
    rm .git/index 
    git clean -fdx 
     
    git add your files 
    git commit -m 'Initial commit'
    

提交回复
热议问题