Skip to content

Instantly share code, notes, and snippets.

@ctrochalakis
Created October 19, 2010 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ctrochalakis/634098 to your computer and use it in GitHub Desktop.
Save ctrochalakis/634098 to your computer and use it in GitHub Desktop.
Rake task to generate an html branch for jekyll
desc "Commit website to html branch"
task :html do
system <<-GITFOO
test -e 'for_html' && rm -rf for_html
test -e '.git/html.index' && rm .git/html.index
jekyll --no-auto for_html
export GIT_INDEX_FILE=.git/html.index
git add -f for_html
tree_id=$(git write-tree --prefix=for_html/)
new_commit=$(echo "New website!"|git commit-tree $tree_id -p refs/heads/html)
git update-ref refs/heads/html $new_commit
test -e 'for_html' && rm -rf for_html
test -e '.git/html.index' && rm .git/html.index
GITFOO
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment