git - I want to push the dist folder under the master branch to the gh-pages branch. Is there any simple way?
曾经蜡笔没有小新2017-05-02 09:46:13
0
3
1016
I think there is no need to branch master in build first and then copy the dist folder to the gh-pages branch and then submit it How do you guys manage the gh-pages branch?
Have you read the update notes recently posted on Github?
https://github.com/blog/2228-...
Of course, if you really want to use gh-pages (or any other directory name), here is what I think is the simplest method:
First step
/dist
目录需要被 git 记录,于是后面我们才可以用它作为子树(subtree),因此/dist
不能被.gitignore
Rule ExclusionsStep 2
git subtree push --prefix dist origin gh-pages
Done. Among them:
dist
代表子树所在的目录名origin
是 remote namegh-pages
is the target branch namenpm intall gh-pages
gh-pages has been upgraded and it seems that a separate branch is no longer needed.
In the past, I wrote a separate command for this thing.
It looks like this:
Which
git
函数是使用require('child_process').spawn
is the encapsulated child process.