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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:44:14+00:00 2026-05-22T20:44:14+00:00

Since github doesn’t execute (the safe option for jekyll) plugins, I am trying to

  • 0

Since github doesn’t execute (the safe option for jekyll) plugins, I am trying to develop a small and clean way to deploy the compiled files to the branch master.

The usual source is in the branch boilerplate, from there I run jekyll and generate the code, everything works.

In the master branch I only have the following Makefile

default:
    git checkout boilerplate
    git subtree split -P _site -b site
    git checkout master
    git merge -X theirs site
    git branch -D site

and the file .nojekyll (I’m using the subtree command from here)

However this does not work. It generates the site branch with all the code, but when I merge into master, all it says is:

Already up-to-date.

How to fix this?

What I want to accomplish is to overwrite any existing files in master BUT not delete the files which don’t exist in branch site (like the aforementioned Makefile and .nojekyll, which is important to be kept there).

Note: I want to do it from scratch in order to maintain control over the deployment process. I don’t want to 1. introduce new dependencies 2. use other tools.

  • 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-22T20:44:15+00:00Added an answer on May 22, 2026 at 8:44 pm

    As I told on IRC I’d go with a git hook (git help hooks)

    I hacked this script real quick.
    Place it under $GIT_DIR/.git/hooks/.

    I tested it as a post-commit hook commiting from $_origbranch and checked the results on the other branch ($_destbranch).

    It should kind-of do what you want. Worked fine, so I hope it fits you or steers this into somewhat right direction.

    #!/usr/bin/env bash
    
    # executables prefix
    _prefix="/usr/bin"
    # git executable
    _git="$_prefix/git"
    
    # site generation executable
    _generate="$_prefix/jekyll"
    # options for the generator
    _opts=(--no-safe --no-server --no-auto --kramdown)
    
    # branch from which to generate site
    _origbranch="master"
    # branch holding the generated site
    _destbranch="gh-pages"
    
    # directory holding the generated site -- should be outside this repo
    _site="$("$_prefix/mktemp" -d /tmp/_site.XXXXXXXXX)"
    # the current branch
    _currbranch="$(/bin/grep "^*" < <("$_git" branch) | /bin/cut -d' ' -f2)"
    
    if [[ $_currbranch == $_origbranch ]]; then # we should generate the site
        # go to root dir of the repo
        cd "$("$_git" rev-parse --show-toplevel)"
        # generate the site
        "$_generate" ${_opts[@]} . "$_site"
        # switch to branch the site will be stored
        "$_git" checkout "$_destbranch"
        # overwrite existing files
        builtin shopt -s dotglob
        /bin/cp -rf "$_site"/* .
        builtin shopt -u dotglob
        # add any new files
        "$_git" add .
        # commit all changes with a default message
        "$_git" commit -a -m "updated site @ $(date +"%F %T")"
        # cleanup
        /bin/rm -rfv "$_site"
        # return
        "$_git" checkout "$_origbranch"
    fi
    

    have fun o/


    Just an update to say this works with bash and Linux.
    It can probably be written in POSIX sh too.
    Also, I believe mktemp is GNU-coreutils only, so other systems may need to replace this.

    NOTE: this only runs when you commit in the branch specified by $_origbranch. You can ofcourse change that. I believe it’s simple enough for anyone to do that.

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

Sidebar

Related Questions

Since CS3 doesn't have a web service component, as previous versions had, is there
Since Graduating from a very small school in 2006 with a badly shaped &
I'm a committer on a project with a GitHub repo. I have a small
I'll try here since the mailing list for DM doesn't seem to have much
I've seen http://github.com/muness/migration_sql_generator , but it doesn't work properly with MySQL for certain important
I want to compile an open source iPhone app( https://github.com/newsyc/newsyc/ ) but since I
I have forked a repository on github some time ago, made a small change
is there a way to automatically get git/github to update the doc tags in
I am using this class: https://github.com/alexleutgoeb/ALPickerView Since I converted to ARC, I get this
Since I started studying object-oriented programming, I frequently read articles/blogs saying functions are better,

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.