Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7975253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:36:06+00:00 2026-06-04T08:36:06+00:00

Developing on github, I often maintain a html/ or _site/ subdirectory in my master

  • 0

Developing on github, I often maintain a html/ or _site/ subdirectory in my master branch where I generate web-based documentation for the project. I’d like to switch to my gh-pages branch and pull just the contents of this html directory into the root of the gh-pages branch, so it will render as a nice website through github (which automatically renders html in gh-pages at username.github.com/repositoryname). What is the best workflow to do this?

If I don’t yet have the gh-pages branch set up, I can branch, clear the branch, and copy in the contents of the html directory and presto, I have the a site ready to go. But I’m not sure how best to later update the gh-pages branch.

git branch gh-pages
git checkout gh-pages
# Remove files I don't need from the gh-pages branch
rm -rf data/ man/ R/ README.md NEWS NAMESPACE DESCRIPTION demo/
# move documentation to the root
mv inst/doc/html/* .
# remove the rest
rm -rf inst/
git add *
git commit -a -m "gh-pages documentation"
git push origin gh-pages
git checkout master

Now what should I do to update the gh-pages branch later? It sounds like this might involve subtree merging but I’m not quite sure.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T08:36:07+00:00Added an answer on June 4, 2026 at 8:36 am

    To start your gh-pages branch:

    true | git mktree | xargs git commit-tree | xargs git branch gh-pages
    

    To fetch anything you want into it, say the html directory from the master branch, read-tree and commit:

    git checkout gh-pages
    git read-tree master:html
    git commit -m'gh-pages documentation'
    git push origin gh-pages
    git checkout master
    

    and you’re done.

    Late addition: there’s a shorter sequence for adding to the gh-pages branch:

    git commit-tree -p gh-pages -m "" master:html \
    | xargs git update-ref refs/heads/gh-pages
    

    which doesn’t require flushing the current working tree

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently developing a small hobby project (open sourced at https://github.com/grav/mailbum ) which quite
I am developing an iphone project on xcode and I'd like to commit my
I am developing a kohana project. There is a repository on github for the
I am developing some private projects on Github, and I would like to add
Developing a project of mine I realize I have a need for some level
Developing a project in Django with my IDE setup as Eclipse with PyDev. The
I am developing a Rails app using OmniAuth, OmniAuth-salesforce and this gem: https://github.com/heroku/databasedotcom I
I'm developing a Scalatra web app with Scalate Jade and using sbt 0.11.0 I've
I am developing an Codeigniter based website and I need to send emails to
The Twitter Bootstrap 2.0-wip branch on GitHub includes a new responsive layout system. It's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.