How I Program on the Go

One of my biggest problems when I went on holiday was that I couldn’t update and fix my websites and apps with just my iPad on GitHub. I could have just used the GitHub web editor, but I often found that it didn’t save my changes, and that was a huge problem if I had just made a lot of edits. However, my biggest problem was updating the website via FTP. None of the apps on the App Store helped to solve this issue. However, Textastic, Working Copy and Buddy solved my problem perfectly.

Before you read this post, you may want to check out an older post about how to use Textastic and Working Copy together.

I love using GitHub to host my projects – people can see the source code on the projects I make, contribute to the websites and apps, I can get my GitHub projects on any device, and a lot more (I love the stats on the profile page).

However, I found that whilst I was away on holiday, a school trip or just away from my computer in general, I couldn’t fix the bugs and add to my apps and website, which obviously leads to a pretty big problem. The GitHub web editor didn’t cut it for me – it didn’t save changes a few times, the highlighting didn’t exist, there was no preview – and thats not even mentioning they way it appeared on my iPad screen.

I had been using Textastic for a while before I found out Working Copy. I used to update my code by copying and pasting it from GitHub web, them pasting it into Textastic. I would do my edits, then copy and paste the new code into GitHub web. But, obviously, this had a lot of problems.

Luckily, Working Copy was just what I was looking for. I had tried a few others before Working Copy, but they hadn’t really cut it for me. What makes Working Copy so great – for me at least – is the tight nit integration with Textastic, and the way it just works. In fact, I wrote a whole blog post about using Textastic with Working Copy, which you may want to check out.

I’ll take the chance to say something now – you don’t actually need Textastic to edit or change work via Working Copy. Working Copy comes with a fully functioning text editor, and I would say that the preview on Working Copy is better than Textastic in some respects. However, Textastic has a console that alerts you of errors, as well as brilliant syntax highlighting that really works for me. If you don’t use an external keyboard, Textastic also comes with a shortcut bar at the top of the virtual keyboard, allowing you to quickly get backslashes and that sort of thing, and it saves you a ton of time. Of course, it comes with a ton of other features, so I really recommend you use it along with Working Copy.

So, this is how I start to edit my repos on GitHub. I clone the repo to Working Copy, and then I switch to Textastic. There, I hit open (in the local files and iCloud menu), and I hit Working Copy. A window from Working Copy then opens, asking me to choose the repo I want to edit. I tap on the one that I want, and that repo appears as a folder in Textastic. Then navigate to the file you want, make your edits, and then switch back to Working Copy. It will show the files with changes, and if you added or deleted any files, it will show those too. Go to the ‘Repository Status and Configuration bar at the top, and swipe left. You’ll see a few buttons such as fetch and commit (you may see more depending on the state of your repo). In this case, you want commit. Tap it, and select the files you want to commit.

This bit is important – Working Copy requires you to purchase the ability to push your files to the GitHub server. You can commit the files, but this is only done locally. It won’t make any changes to your GitHub repo. For that, you need to purchase the ability to push. It’s a £10.99 in app purchase, or you can buy Working Copy Enterprise edition, which is the same price, just with the in app purchase already bought. Keep in mind that Working Copy is a free app, but you need to buy that ability that makes it magic. I really recommend you do so!

Anyway, I commit the changes, Working Copy pushes them to the server, and done! They are now on my GitHub page. The branch that I was in will update, and if that branch wasn’t master, I can merge the branch to master after a few checks.

Now they are on the master branch. Now, I want to update my website (you can adapt this for apps like Heroku, as you can make them automatically update via Heroku Pipelines). Note that I’m using a website in the case. I check them on a private server to make sure the changes I made were all okay, and didn’t break anything. I already did this when I originally made the code, but the preview sometimes shows the code slightly different to what it actually looks like on the server, especially if the website is a complex one. Also, I know I shouldn’t use master as a testing branch, but I like to do it that way, so I don’t have to keep a ton of branches in sync with each other.

So now I have checked that the website is working on the server nicely. If it isn’t, I go and fix it, then try again. When it works well, I create a pull request to my ‘public’ branch. My ‘public’ branch is connected to Buddy, and when Buddy detects a change on that branch, it automatically updates my FTP server, therefore updating the public site.

Even if you don’t code on the go, you may want to check Buddy out. It’s simplified my workflow a lot as I don’t have to update my FTP manually, and I really recommend it.

And the changes are live!

So thats how I program on the go. This works on both your iPad and iPhone. It works really well, and I love using all the apps involved in this workflow. Obviously, it’s not as great as using a desktop to do this all. One of my major annoyances is that in Textastic, I can’t do find and replace in a whole project. This means if I want to change a title or link in the header, I have to find and replace in every single individual files. Whilst this may not be a problem for small projects, it certainly is for large projects that I work on.

I really recommend giving all three apps a try. Once again, they are Textastic, Working Copy and Buddy. They’ve certainly saved me when my website broke when I was away, and they might one day save you too!

I hope you enjoyed reading, and have a great new year!

How to you program on the go? Feel free to comment below!