github如何在新的git分支gh-pages中包含来自master的文件 [英] github how to include files from master in new git branch gh-pages

查看:72
本文介绍了github如何在新的git分支gh-pages中包含来自master的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

github有这个功能,如果你在你的项目中创建一个新的分支gh-pages,你可以发布Project Pages。详情请参阅 http://pages.github.com/



我的项目只是HTML /图像,所以我只想为master分支提供服务。



那么如何创建一个名为gh-pages的新分支那只是主人的精确副本?
某种链接操作?



谢谢

解决方案

您希望GitHub仓库中的分支'gh-pages'与'master'分支相同。最简单的解决方案是将git配置为自动将分支'master'推送到'gh-pages'。

假设您将GitHub存储库推入的配置为'origin '远程,你可以这样做:

  $ git config --add remote.origin.push + refs / heads / master:如果你愿意,你可以简单地编辑  






<直接使用.git / config
文件。

然后,当您执行 git push git push origin 您可以将资源库中的'master'分支推送到GitHub上的'gh-pages'分支。



有关文档,请参见 git-push手册页和refspec格式的说明。

github has this feature where you can publish "Project Pages" if you create a new branch gh-pages in your project. For full description see http://pages.github.com/

My project is just html/images, so I just want to serve the master branch.

so how do I create a new branch called gh-pages that is just exact copy of master? some kind of link operation?

Thanks

解决方案

You want branch 'gh-pages' in your GitHub repository to be the same as 'master' branch. The simplest solution would be to configure git to push branch 'master' to 'gh-pages' automatically.

Assuming that your GitHub repository you push into is configured as 'origin' remote, you can somply do:

$ git config --add remote.origin.push +refs/heads/master:refs/heads/gh-pages

Or if you prefer you can simply edit .git/config file directly.

Then when you do git push or git push origin you would push 'master' branch in your repository into 'gh-pages' branch into repository on GitHub.

See git-push manpage for documentation and description of refspec format.

这篇关于github如何在新的git分支gh-pages中包含来自master的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆