Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
687 views
in Technique[技术] by (71.8m points)

github how to include files from master in new git branch gh-pages

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...