git: put a branch in a subdirectory

后端 未结 6 1391
北恋
北恋 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

    Starting with git 2.5, you can have both branches checked out at the same time in different directories. See https://github.com/blog/2042-git-2-5-including-multiple-worktrees-and-triangular-workflows. Setup via git worktree add -b gh-pages ../gh-pages origin/gh-pages.

    If you want to have the content of a subdirectory of your master checkout to be put into gh-pages on github, use the script provided at https://github.com/X1011/git-directory-deploy.

提交回复
热议问题