Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
678 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 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...