trhall chop image Thomas R. Hall Thoughts...

Using Working Copy for Mobile Blogging

Working Copy commit dialog

In my previous post on setting up Jekyll to publish to GitHub Pages, I mentioned some alternative ways to post content to a Jekyll blog. Since I’m using GitHub Pages and the Git version control system, things aren’t as simple as dealing with a file and directories on my monitor device. Or is it? This is where Working Copy for iOS comes in.

My Mobile Blogging Setup

I use the following tools when blogging from iOS:

  • iPhone or iPad - I can use one or the other, or both, if I’m keeping content synchronized with the server.
  • Working Copy - Used to manage my Git repositories on GitHub.
  • Editorial - Has enhanced Markdown editing capabilities, a quick swipe to preview content mode, and other custom workflow capability using Python. Integrates with Working Copy via an installable workflow.
  • Swype or a Bluetooth Keyboard - If I happen to have a Bluetooth keyboard, I’ll use it. Otherwise, Swype allows me to quickly type content with a finger or stylus.

While Editorial and a faster input method are certainly not required, they do speed up my ability to create content.

An Aside: Version Control Systems

Before we dive in too deep, is helpful to understand what a distributed version control system like Git is. Basically, think of GitHub as the master or authoritative source of your content.

When you clone a repository to your local machine, you can make modifications. But if you want the master repository to reflect these changes, you have to send those changes back. In Git terminology, you are committing and pushing changes back to the master repository.

Similarly, if you want to reflect changes pushed to your master repository from other devices, you need to fetch those changes and merge them into your local repository. This allows you to see any modifications and also merge differences you may have made to the same article on multiple devices.

Setting up Working Copy

Working Copy can work with multiple repositories. So if you have multiple blogs, you can edit and maintain them all. Setup is fairly simple:

  1. Authorize access to your GitHub account, if you haven’t already (a one-time action)
  2. Clone a repository
  3. There is no Step 3

Working Copy Clone repository choice

Click the plus sign in the top right of the Repositories pane on the left side of the screen. Choose Clone Repository, select GitHub, then select the repository you’d like.

Working Copy Clone repository dialog

Adding/Modifying Content

Now that you have a local copy of a repository, you can add or edit content. Navigate to the location you want to add content in the repository browser pane on the left and then click the plus button. You can create a new text file, import images, or add other files to your site.

Working Copy Add item dialog

  • Create/edit content
  • Commit changes

Working Copy changes pending upload

Once you’re ready to push your changes, simply swipe left on your repository and choose Commit. You’ll also notice an option to Fetch. It’s best practice to fetch remote changes before you commit your changes, so I would fetching/merging and then committing.

Working Copy changes commit fetch

Synchronizing Changes Made Elsewhere

Oftentimes, you may have made changes elsewhere. Maybe your desktop or another mobile device. In these cases, you need to update your local copy. Swipe left on your repository and choose Fetch, then swipe left again and choose Merge.

Unless you have conflicting changes, everything will automatically “synchronize”. Once you’ve merged in remote changes to once fetched, your local repository is current.

A Concrete Example

This post was composed on an iPad. Screenshots were taken on the iPad, cleaned up using some editing tools, then optimized using Images and the post were uploaded to GitHub via Working Copy.

Working Copy Rename File

Once I was satisfied with the draft, I renamed the file to include the date in the file name. This tells Jekyll that the post is no longer a draft and should be published.