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 6375563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:37:53+00:00 2026-05-25T01:37:53+00:00

I have a simple static website, based on HTML 5 boilerplate and the whole

  • 0

I have a simple static website, based on HTML 5 boilerplate and the whole thing is in a github repository. The project structure is something like this

build
css    
img
js
publish    # this directory isn't in source control!

...

index.html & other files

Basically what I do is run a build script (from HTML 5 boilerplate) that compiles all the HTML/CSS/JS into the publish directory, which isn’t in the git repository.

Now what I want to do, is make use of GitHub pages and be able to use the publish directory output as a GitHub page.

The way GitHub pages work, is that you create a clean separate branch named gh-pages, which will contain the final content. What I want to do, is to be able to on demand commit the current publish directory into the gh-pages branch, but I also want to keep it in the main .gitignore file so it won’t get pushed into the source repository.

I want to do this to kinda preview the current state of the project.

in short: I need to commit one directory to a separate branch, so it’s root will be the same as contents of that one directory. publish/css will become just css on the gh-pages branch

  • 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-05-25T01:37:54+00:00Added an answer on May 25, 2026 at 1:37 am

    Since .gitignore is versioned as well, just don’t put the publish/ directory in the gh-pages branch’s .gitignore file. Then, you can just do something like this:

    ORIG_HEAD="$(git name-rev --name-only HEAD)" git checkout gh-pages && mv publish/* . && git commit -am "automatic update" && git checkout "$ORIG_HEAD"
    

    It does get tricky since you’re wanting to do things in the root directory rather than a subdirectory. Another option would be to simply maintain a separate clone of the same repository in a different directory, that is always on the gh-pages branch. You could have your script just write the files to there instead of to publish/ and then just commit in that clone.

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

Sidebar

Related Questions

I have a simple website(primarily static html/css) but for some reason some of the
I have done a couple of simple swing based apps with static layout, but
I have a static website using Jekyll hosted on GitHub. The problem is, I
I have a simple static website with a couple lines of text in it.
I have a simple website in django where the content is static. Where i
We have a very simple ASP.NET web application comprising mostly static content and a
I have a very simple CLR Function for doing Regex Matching public static SqlBoolean
I have a very simple code: package mygame; public class RunGame { public static
I have a binary file - Windows static library (*.lib). Is there a simple
I have a website running on a google app engine. Like any website these

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.