关于git 提交到分支

想必大家对于github并不陌生,但是有时候我们提交到github上的页面,想将静态的页面展示给别人看,所以这个时候,需要创建一个gh-pages的分支,然后利用

https://you github name.github.io/project/projectht.html      

但是咱们本地从github上git clone自己的代码的时候,默认的分支是master。但是,咱们不仅要提交到github上的master的分支,还需要提交到github上的gh-pages分支上,这个时候,怎么提交呢,,

1。本地创建gh-pages  分支  git branch -b gh-pages

2.本地切换 gh-pages分支      git checkout gh-pages

3.更新远程的gh-pages分支    git pull origin  gh-pages

4.正常的add 文件   commit文件

5最后git  push   origin gh-pages    

最后结果,完美,所提交的文件就在远程主仓库的gh-pages的分支上了,于是就可以访问静态页面啦

原文地址:https://www.cnblogs.com/lhyforfront/p/6668235.html