Tuesday Tip: Using Git with Google Apps Script

One of the biggest issues with Google Apps Script (GAS) is that it doesn’t have any real version control system. Last month I started using GitHub (through this course on Udacity) and was disappointed to discover that there is no way to directly integrate Git with GAS projects. If you’ve never used Git, it’s an awesome way to keep track of and merge code file versions. Without it, it can be extremely hard to try out new things or discover when bugs have been introduced. There’s a GAS ticket open for this lack of version control, so please star it if you agree that it’s a problem.

Fortunately, there’s a workaround. The Google Plugin for Eclipse

allows you to keep GAS projects on your local machine (and integrate with Git), while automatically syncing with the real project in the cloud.

On top of Git integration, using Eclipse with GAS is just a better way to write code. It’s a much cleaner interface and has a lot of tools that aren’t available in the GAS code editor.

I’ve been using this setup for about two weeks now, and so far, it works pretty well. However, there are a few things to be careful about:

  • Changes made directly in the GAS code editor online weren’t always reflected locally. This means that I’ve had to switch to working exclusively on my local copies in Eclipse. It’s all fine and good, but if I actually want to test any code, I need to refresh the same copies online.
  • Some options that exist online don’t really work with the Eclipse Google Plugin. For example, renaming a file in the GAS code editor is straightforward, but doing that through Eclipse creates a copy of the original file with a new name, then deletes the original file.
  • You need to keep some of GAS’s idiosyncrasies in mind while working in Eclipse. It won’t warn you if you try to create a file type that doesn’t exist in GAS, for example.

Overall, I’ve enjoyed using the Google plugin for Eclipse. I’ve been using it on a remote freelance project for a nonprofit. I’ve enjoyed the security of knowing that I can try new things in GAS without (too much) fear of creating terrible bugs. At the same time, I’m looking forward to real Git integration with GAS.