git: put a branch in a subdirectory

后端 未结 6 1390
北恋
北恋 2021-02-04 00:35

I have a git repository (at github.com) with two branches: master and gh-pages. I would like to have the gh-pages branch in a subdirectory, so that I don\'t need to switch branc

6条回答
  •  孤独总比滥情好
    2021-02-04 01:02

    You may be looking for the subtree merging option.

    It will let you checkout an unrelated branch into a subdirectory of another and then merge back and forth between them. You would still have to checkout gh-pages and merge in changes from the main repo before pushes would go live on GitHub, however.

    You could also check gh-pages out as a submodule of your master branch if that suits you better.

提交回复
热议问题