Coding on the Go

I’m one of those weirdos who wants to code on my phone. Sometimes I’ll just get bored waiting in a lobby, riding on the ‘L’, sitting at a boring party, or sometimes I just don’t have my MacBook near me and inspiration strikes. A year ago I would have thought complete project management on iOS was impossible but it turns out you can now do everything from writing code, SSHing into servers, and managing Git repositories all from the comfort of your iPhone. Today I’m going to show you how you can manage any coding project from your phone.

Note that this is for people with iDevices. So anyone with an iPod, iPhone, iPad, etc. can do this. Sorry Android users, I’m sure there are similar apps for your platform but as an avid Apple user I can only speak to how to do this on iOS/OS X .

The workflow we’re trying to replicate

We’re all used to managing projects using our desktop or laptop computers but now we can do all of that on an iPhone/iPad. My usual desktop workflow consists of managing files/folders in Terminal, editing code with Sublime Text, and then it’s back to the terminal to commit and push my code to my private repository or a GitHub repo. So the basic workflow looks like this:

  1. Initialize a local git repository or cd into an existing repository on your computer
  2. Open the project in your text editor of choice
  3. Make edits
  4. Move back over to your terminal then git add, git commit and git push when you’re finished
  5. Sometimes you’ll deploy a project with Git hooks and you’ll need to SSH into a server to run some commands to restart a Rack server or Node process manager. We can cover that too.

Versioning with Git

Whether you already have a Git remote set up on GitHub or private server you’ll want to start with the excellent Working Copy app for iOS. Working Copy allows you to clone projects to your phone or initialize a new repo right in the app.

To create a new repository from scratch open Working Copy and press the + button at the top of the screen. You’ll have the option of initializing a new repository locally (which you can then push to a remote later) or clone an existing repo from elsewhere.

Initialize git repo in Working copy

At this point you’ll have a brand new empty git repository stored in Working Copy. You have the option to look at what git status would tell you about the files in your repository or choose the “Repository” option to access settings like setting up remotes, adding, committing, and pushing files in a commit.

Initialize git repo in Working copy

From this screen you can then create new files to add to your repository by pressing the + button again. Working Copy lets you edit files right in the app but I prefer working in Textastic because it’s a better editing experience. So press the + button and choose “Create Text File” (or whatever option suits you best if you want to go off script here and use this guide as a tool to help set up your own custom project).

Initialize git repo in Working copy

To open the file you added to your Git repo in Textastic tap the share button at the top of the screen and choose “Edit in Textastic”. (*Note: You may have to choose the “More…” option and enable Textastic to show up in the menu).

Initialize git repo in Working copy

Now you’ll be sent to Textastic for editing.

Text editing

The first developer tool you’ll crave on your iPhone is going to be a good text editor. TextTastic has got you covered in that department. You can start entire projects complete with folder structures and everything. It has syntax highlighting and keyboard extensions that make those weird characters developers need easy to access. When working with Git repositories using this app along with Working Copy makes the tool so much more powerful. If you’ve followed the steps above then you’ll have a file open in Textastic. Edit that file to your liking and then choose the sharing button again and choose “Save in Working Copy”. This will send the file back to the Git repository you had open in Working Copy, merge the files as best it can, and then make it available for committing.

Initialize git repo in Working copy

Back in Working Copy you’ll see a list of changed files similar to what you’d see when running git status from the terminal.

Initialize git repo in Working copy

Tap on the Repository option and you’ll see options to commit, revert, add remotes, and many more depending on your specific situation.

Initialize git repo in Working copy

Here you’ll want to choose to commit. If you’ve cloned down an existing project you’ll have options to synchronize your local and remote code. If not you’ll be able to add a Git remote before proceeding.

In either case, Working Copy along with Textastic allows you to use your standard Git workflow all from the comfort of your iOS app.

How to best use it

The best way to get this up and running is to simply play around with it. Adding git remotes may be harder if your starting a brand new project from your iOS device but if you’re cloning a project from GitHub or elsewhere things are easier. In either case, the workflow is the same. Practice using these tools together to get the hang of the workflow. Once you do you’ll be amazed at how productive you can be with just the phone in your pocket.

Now let’s add in SSH

Prompt by Panic is a great SSH tool that lets you SSH into any server using public key authentication or password authentication. Anything you can do with SSH on the command line is available in Prompt.

When you first download prompt be sure to generate a new public/private key pair and add your new mobile public key to all your servers so you can log in. I won’t go through the details here as its pretty self explanatory.

So what can you do with all of these tools? My workflow looks like this:

  1. Edit files in Textastic
  2. Commit and push them in Working Copy
  3. SSH into my server and run any commands needed to restart my applications.

Getting the tools

These tools aren’t free but are well worth the cost. If you’re a weirdo like me who likes to edit code on the go these three apps are invaluable parts of a mobile developer’s workflow. Check them out today. You won’t be disappointed.

Project management, Web development

« Training Wheels Don't steal code (Catfish for Code) »