Using Git with Real Studio / Xojo

I’m a huge fan of Git for source code management. I’m also a huge fan of Real Studio (soon to be “Xojo”) for developing OS X apps and console tools. I’ve been developing Blast Image Config in Real Studio for over ten years.

I was using subversion (SVN) for close to over 4 years. At first I really liked it because I finally had a source code management system.

But over the years I started to have gripes about it that just wouldn’t go away, like:

  1. I had to have a network connection to push a commit. This was very limiting because I travel a lot and often don’t have network connections, or don’t want to fire up the VPN client to connect to my office SVN server.
  2. That annoying “.svn” directory in every folder. Yeah, that. Moving directories around really ticks off SVN.
  3. Adding items to be ignored are kinda of tedious to do in SVN.
  4. Checking out different commit checkpoints were often slow with very large repositories because SVN needs to re-download all file differences from the network.
  5. Branching and merging was possible, but never easy or fun to do, so I avoided it, like everyone else that uses SVN pretty much (from what I’ve read and heard from others).

Then I heard about Mercurial and Git after reading¬†Joel Spolsky’s post about converting from SVN to Git.

The distributed part of Git is what really intrigued me. Along with pretty much all of the other things that it offered over SVN, honestly.

So I started using Git over a year ago, and have never looked back. It solved ALL of the issues that I listed above.

Now I use SourceTree (which is available for both OS X and Windows, and is totally free. And awesome).

There’s also Tower¬†for OS X, which isn’t free, but also looks very “pretty.”

A tip for Real Studio and Xojo Developers using Git Users (Thanks to Norman, and Tobias on the Xojo Forums):

Git doesn’t like text files that end with Carriage Returns chr(13) and therefore doesn’t think the files are “real” text files. It prefers that the line endings are UNIX Line Feeds chr(10).

Real Studio 2012r2.1 defaults to using CR’s on OS X. Since Git doesn’t like this line ending, you need to use external apps like Kaleidoscope (My favorite GUI Diff App) to view the diffs, which can slow down committing a little.

But there’s an easy fix for this, it turns out. (Keep in mind that you do NOT need to do this in order to use Git with Real Studio, but it makes seeing code changes/diffs a little easier.)

  1. Open your project manifest file ( YourRSProject.rbvcp ) in BBEdit (or Text Wrangler) and change the line endings to “LF” and save the file.
  2. Then launch Real Studio and do a “File -> Save As …”, which will force RS to re-save all of the VCP files with the same line endings (Thanks, Tobias!). Commit the changes to Git. Yes, Git will show that ALL of your project files have changed, which is true, since the line endings were updated.
  3. Then the next changes you make will be easier to view using Git’s built-in diff engine, as well as SourceTree’s differences pane.

Hope this helps someone using Git and Real Studio / Xojo.

Note: Xojo defaults to using Line Feeds (LF) with new projects on OS X, which Git loves, and so do I.

Posted in Programming, Real Studio, Xojo | Tagged , | 2 Comments