In git, is there a simple way of introducing an unrelated branch to a repository?

前端 未结 9 2080
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 06:11

While helping a friend with a git problem today, I had to introduce a branch that needed to be totally separate from the master branch. The contents of this bra

9条回答
  •  醉酒成梦
    2020-11-22 06:56

    Sometimes I just want to create empty branch in project instantly then start doing work, I will just excute following command :

    git checkout --orphan unrelated.branch.name
    git rm --cached -r .
    echo "init unrelated branch" > README.md
    git add README.md
    git commit -m "init unrelated branch"
    

提交回复
热议问题