push local master *into* gh-pages branch on github

前端 未结 4 800
陌清茗
陌清茗 2021-02-01 05:45

I created a simple gh-pages branch on github and in my local repo. I used the auto page generator to create the 5 files it uses: images javascripts stylesheets index.h

4条回答
  •  耶瑟儿~
    2021-02-01 06:40

    as an alternative approach, how about using a git subtree to serve as your gh-pages branch?

    git checkout master
    git subtree push --prefix . origin gh-pages
    

    according to the git-subtree docs on the source code:

    Subtrees allow subprojects to be included within a subdirectory of the main project, optionally including the subproject's entire history.

    in our case, we may be able to alias the same path (the root path; .) as a virtual copy of the master branch (i have not tested it, though).

    by the way, i found out about subtrees after encountering this gist, by cobyism.

提交回复
热议问题