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

前端 未结 9 2159
被撕碎了的回忆
被撕碎了的回忆 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 07:16

    In recent Git versions, 2.27 at least, this can be cleanly achieved with the switchcommand:

    git switch --orphan 
    

    Official documentation: https://www.git-scm.com/docs/git-switch

提交回复
热议问题