git: put a branch in a subdirectory

后端 未结 6 1397
北恋
北恋 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:15

    That's not how things are designed to work. You could theoretically clone the repository within a subdirectory of your original clone and mark that directory as excluded from the higher level repository, but wouldn't it be much simpler to just check it out in a completely different directory instead of a subdirectory?

    That is to say...

    /repo/master/(clone on master branch)
    

    and then another clone that's on the other branch

    /repo/gh-pages/(clone on gh-pages branch)
    

提交回复
热议问题