Creating a new empty branch for a new project

前端 未结 8 2006
你的背包
你的背包 2020-11-28 00:10

We are using a git repository to store our project. We have our branches departing from the original branch. But now we want to create a small new project to track some docu

相关标签:
8条回答
  • 2020-11-28 00:48

    If your git version does not have the --orphan option, this method should be used:

    git symbolic-ref HEAD refs/heads/<newbranch> 
    rm .git/index 
    git clean -fdx 
    

    After doing some work:

    git add -A
    git commit -m <message>
    git push origin <newbranch>
    
    0 讨论(0)
  • 2020-11-28 00:55

    You can create a branch as an orphan:

    git checkout --orphan <branchname>
    

    This will create a new branch with no parents. Then, you can clear the working directory with:

    git rm --cached -r .
    

    and add the documentation files, commit them and push them up to github.

    A pull or fetch will always update the local information about all the remote branches. If you only want to pull/fetch the information for a single remote branch, you need to specify it.

    0 讨论(0)
提交回复
热议问题