12 Feb 2009
I’ve hosted my personal web site and blog at GitHub Pages for a few weeks now. GitHub Pages relies on Jekyll, and I’ve come to like Jekyll a lot. That said, a minor issue I’ve run into is how to organize unpublished posts. Let me outline the solution that I’ve come up with.
As usual, use today’s date in the file name of the new post, whether or not you expect to finish it today.
$ gedit _posts/2009-02-11-blogging-like-a-configuration-manager.textile
If you don’t finish the post in one go, create a new branch named after it and commit your work.
$ git checkout -b blogging-like-a-configuration-manager
$ git add _posts/2009-02-11-blogging-like-a-configuration-manager.textile
$ git commit -m "editing new post"
Keep editing the post until you’re happy with it. You can have multiple branches at the same time, one for each post that you’re working on.
Optionally, push your branches to GitHub for backup.
$ git push origin blogging-like-a-configuration-manager
Ready to publish a post? Change its date to today’s date, and merge its branch into the master branch. Push the master branch to GitHub.
$ git checkout blogging-like-a-configuration-manager
$ git mv _posts/2009-02-11-blogging-like-a-configuration-manager.textile _posts/2009-02-12-blogging-like-a-configuration-manager.textile
$ git commit -m "renamed to today's date"
$ git checkout master
$ git merge blogging-like-a-configuration-manager
$ git push origin master
Now I can work on multiple posts in parallel, preview them locally with the Jekyll-launched web server, keep them backed up at GitHub, and publish them independently of each other.
Edit: Added example commands.