创建github仓库的gh-pages分支

git symbolic-ref命令将当前工作分支由master切换到一个尚不存在的分支gh-pages。

$ git symbolic-ref HEAD refs/heads/gh-pages

删除暂存区文件,即相当于清空暂存区。

$ rm .git/index

创建项目首页index.html

$ printf "hello world.\n" > index.html

添加文件index.html到暂存区。

$ git add index.html

执行提交。提交完毕分支gh-pages完成创建。

$ git commit -m "branch gh-pages init"

执行推送命令,在github远程版本库创建分支gh-pages。

$ git push -u origin gh-pages
posted @ 2017-12-30 17:38  月半流云  阅读(493)  评论(0编辑  收藏  举报